模版下 server文件配置
This commit is contained in:
parent
7e72576914
commit
46cf0e9ab2
|
|
@ -1,4 +1,4 @@
|
||||||
import accessConfiguration from './access.dev';
|
import accessConfiguration from './access.dev';
|
||||||
export default accessConfiguration;
|
export default accessConfiguration;
|
||||||
export * from './access.dev';
|
|
||||||
console.log('不应该跑到这里');
|
console.log('不应该跑到这里');
|
||||||
|
|
@ -1,22 +1,28 @@
|
||||||
import { ServerConfiguration } from 'oak-domain/lib/types/Configuration';
|
import { ServerConfiguration } from 'oak-domain/lib/types/Configuration';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { nginxServerProxyPath, nginxSocketProxyPath, port } from './common';
|
import { nginxServerProxyPath, nginxSocketProxyPath, port } from './common';
|
||||||
import { hostname } from './access';
|
import { hostname as hostnameDev } from './access.dev';
|
||||||
import { ssl as sslProd } from './access.prod';
|
import { ssl as sslProd, hostname as hostnameProd } from './access.prod';
|
||||||
import { ssl as sslStaging } from './access.staging';
|
import { ssl as sslStaging, hostname as hostnameStaging } from './access.staging';
|
||||||
|
|
||||||
const NgixConfDict: Record<string, ServerConfiguration['nginx']> = {
|
const HostnameDict: Record<string, string> = {
|
||||||
'staging': {
|
staging: hostnameStaging,
|
||||||
|
production: hostnameProd,
|
||||||
|
development: hostnameDev,
|
||||||
|
};
|
||||||
|
|
||||||
|
const NginxConfDict: Record<string, ServerConfiguration['nginx']> = {
|
||||||
|
staging: {
|
||||||
ssl: sslStaging,
|
ssl: sslStaging,
|
||||||
apiPath: nginxServerProxyPath,
|
apiPath: nginxServerProxyPath,
|
||||||
socketPath: nginxSocketProxyPath,
|
socketPath: nginxSocketProxyPath,
|
||||||
},
|
},
|
||||||
'production': {
|
production: {
|
||||||
ssl: sslProd,
|
ssl: sslProd,
|
||||||
apiPath: nginxServerProxyPath,
|
apiPath: nginxServerProxyPath,
|
||||||
socketPath: nginxSocketProxyPath,
|
socketPath: nginxSocketProxyPath,
|
||||||
},
|
},
|
||||||
'development': undefined,
|
development: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const serverConfiguration: ServerConfiguration = {
|
const serverConfiguration: ServerConfiguration = {
|
||||||
|
|
@ -25,8 +31,8 @@ const serverConfiguration: ServerConfiguration = {
|
||||||
path: join(__dirname, '..', '..'),
|
path: join(__dirname, '..', '..'),
|
||||||
},
|
},
|
||||||
port,
|
port,
|
||||||
hostname,
|
hostname: HostnameDict[process.env.NODE_ENV as string],
|
||||||
nginx: NgixConfDict[process.env.NODE_ENV as string],
|
nginx: NginxConfDict[process.env.NODE_ENV as string],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default serverConfiguration;
|
export default serverConfiguration;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue