刘光辉
12 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
 
import { defineConfig } from 'vite';
 
import { createGatewayConfig } from './src/gateway.mjs';
import { parseRegistry } from './src/registry.mjs';
 
const registry = parseRegistry(readFileSync(resolve(import.meta.dirname, '../registry.yaml'), 'utf8'));
const port = Number(process.env.ONLYOFFICE_GATEWAY_PORT ?? '4173');
if (!Number.isInteger(port) || port < 1024 || port > 65_535) throw new Error('ONLYOFFICE_GATEWAY_PORT 无效');
 
export default defineConfig(createGatewayConfig(registry, {
  host: process.env.ONLYOFFICE_GATEWAY_HOST ?? '0.0.0.0',
  port,
}));