模版下 server文件配置

This commit is contained in:
wkj 2024-04-25 18:27:59 +08:00
parent 7e72576914
commit 46cf0e9ab2
2 changed files with 16 additions and 10 deletions

View File

@ -1,4 +1,4 @@
import accessConfiguration from './access.dev';
export default accessConfiguration;
export * from './access.dev';
console.log('不应该跑到这里');

View File

@ -1,22 +1,28 @@
import { ServerConfiguration } from 'oak-domain/lib/types/Configuration';
import { join } from 'path';
import { nginxServerProxyPath, nginxSocketProxyPath, port } from './common';
import { hostname } from './access';
import { ssl as sslProd } from './access.prod';
import { ssl as sslStaging } from './access.staging';
import { hostname as hostnameDev } from './access.dev';
import { ssl as sslProd, hostname as hostnameProd } from './access.prod';
import { ssl as sslStaging, hostname as hostnameStaging } from './access.staging';
const NgixConfDict: Record<string, ServerConfiguration['nginx']> = {
'staging': {
const HostnameDict: Record<string, string> = {
staging: hostnameStaging,
production: hostnameProd,
development: hostnameDev,
};
const NginxConfDict: Record<string, ServerConfiguration['nginx']> = {
staging: {
ssl: sslStaging,
apiPath: nginxServerProxyPath,
socketPath: nginxSocketProxyPath,
},
'production': {
production: {
ssl: sslProd,
apiPath: nginxServerProxyPath,
socketPath: nginxSocketProxyPath,
},
'development': undefined,
development: undefined,
};
const serverConfiguration: ServerConfiguration = {
@ -25,8 +31,8 @@ const serverConfiguration: ServerConfiguration = {
path: join(__dirname, '..', '..'),
},
port,
hostname,
nginx: NgixConfDict[process.env.NODE_ENV as string],
hostname: HostnameDict[process.env.NODE_ENV as string],
nginx: NginxConfDict[process.env.NODE_ENV as string],
};
export default serverConfiguration;