feat(config): allow server settings via config file with env precedence#1554
Open
akagifreeez wants to merge 1 commit into
Open
feat(config): allow server settings via config file with env precedence#1554akagifreeez wants to merge 1 commit into
akagifreeez wants to merge 1 commit into
Conversation
The server port, HTTPS server port, UI host, UI port and HTTPS UI port could only be set via environment variables, with defaults hard-coded in src/config/env.ts - unlike every other setting, which lives in the config schema/file. This legacy split is confusing for operators (finos#1553). Move these five settings into the config schema and proxy.config.json defaults, mirroring GIT_PROXY_COOKIE_SECRET: the environment variable (when set) takes precedence over the config file, which takes precedence over the built-in default. env.ts now exposes the raw environment values (undefined when unset) so the config file can supply the default. - Add serverPort, httpsServerPort, uiHost, uiPort and httpsUiPort to config.schema.json and proxy.config.json; regenerate config types and schema reference docs. - Resolve them with environment precedence in mergeConfigurations and add getServerPort/getHttpsServerPort/getUIHost/getHttpsUIPort getters; getUIPort now reads the merged config. - Switch the proxy, service, urls and auth-route call sites to the getters, reading lazily instead of at module load. This also fixes the OIDC auth redirect, which fell back to UI port 3000 instead of the configured port.
✅ Deploy Preview for endearing-brigadeiros-63f9d0 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The server port, HTTPS server port, UI host, UI port and HTTPS UI port were only
configurable via environment variables, with defaults hard-coded in
src/config/env.ts—unlike every other setting, which lives in the config schema/file. This legacy split adds
needless complexity for operators.
This moves the five settings into the config schema (
config.schema.json/proxy.config.json), mirroring howGIT_PROXY_COOKIE_SECRETalready works:src/config/env.tsnow exposes the raw environment values (undefinedwhen unset) so theconfig file can supply the default.
getServerPort/getHttpsServerPort/getUIHost/getHttpsUIPort(andgetUIPortnow reads the merged config); the proxy, service, URL helpers and the OIDC authroute read these lazily instead of at module load.
3000insteadof the configured UI port.
Config-file properties added:
serverPort,httpsServerPort,uiHost,uiPort,httpsUiPort.Related Issue
Resolves #1553
Checklist
General
Documentation
Configuration
config.schema.json) was modified:npm run generate-config-types)npm run gen-schema-doc)Tests
npm test) — 808 passednpm run lintandnpm run format:check)npm run check-types)