Merge pull request #1950 from AmericanAirlines/envport

Separate port and host in configuration
This commit is contained in:
Patrik Oldsberg
2020-08-14 12:36:58 +02:00
committed by GitHub
3 changed files with 17 additions and 6 deletions
+3 -1
View File
@@ -4,7 +4,9 @@ app:
backend:
baseUrl: http://localhost:7000
listen: 0.0.0.0:7000
listen:
host: 0.0.0.0
port: 7000
cors:
origin: http://localhost:3000
methods: [GET, POST, PUT, DELETE]
@@ -37,11 +37,18 @@ export type BaseOptions = {
* ```
*/
export function readBaseOptions(config: ConfigReader): BaseOptions {
// TODO(freben): Expand this to support more addresses and perhaps optional
const { host, port } = parseListenAddress(config.getString('listen'));
if (typeof config.get('listen') === 'string') {
// TODO(freben): Expand this to support more addresses and perhaps optional
const { host, port } = parseListenAddress(config.getString('listen'));
return removeUnknown({
listenPort: port,
listenHost: host,
});
}
return removeUnknown({
listenPort: port,
listenHost: host,
listenPort: config.getOptionalNumber('listen.port'),
listenHost: config.getOptionalString('listen.host'),
});
}
@@ -7,7 +7,9 @@ organization:
backend:
baseUrl: http://localhost:7000
listen: 0.0.0.0:7000
listen:
host: 0.0.0.0
port: 7000
cors:
origin: http://localhost:3000
methods: [GET, POST, PUT, DELETE]