cli: add config schema for frontend listening config + fix usage
This commit is contained in:
@@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user