cli: add config schema for frontend listening config + fix usage

This commit is contained in:
Patrik Oldsberg
2020-11-18 10:18:10 +01:00
parent 80bf8c7f4f
commit c7d6fefe9c
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -169,6 +169,22 @@
"visibility": "frontend",
"description": "Tracking ID for Google Analytics",
"example": "UA-000000-0"
},
"listen": {
"type": "object",
"description": "Listening configuration for local development",
"properties": {
"host": {
"type": "number",
"visibility": "frontend",
"description": "The host that the frontend should be bound to. Only used for local development."
},
"post": {
"type": "number",
"visibility": "frontend",
"description": "The port that the frontend should be bound to. Only used for local development."
}
}
}
}
}
+2 -2
View File
@@ -26,9 +26,9 @@ export async function serveBundle(options: ServeOptions) {
const url = resolveBaseUrl(options.frontendConfig);
const host =
options.config.getOptionalString('app.listen.host') || url.hostname;
options.frontendConfig.getOptionalString('app.listen.host') || url.hostname;
const port =
options.config.getOptionalNumber('app.listen.port') ||
options.frontendConfig.getOptionalNumber('app.listen.port') ||
Number(url.port) ||
(url.protocol === 'https:' ? 443 : 80);