You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(config): allow server settings via config file with env precedence (#1554)
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 (#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.
Co-authored-by: Kris West <kristopher.west@natwest.com>
Copy file name to clipboardExpand all lines: config.schema.json
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,26 @@
12
12
},
13
13
"cookieSecret": { "type": "string" },
14
14
"sessionMaxAgeHours": { "type": "number" },
15
+
"serverPort": {
16
+
"type": "number",
17
+
"description": "Port the proxy HTTP server listens on. Can also be set with the GIT_PROXY_SERVER_PORT environment variable, which takes precedence over this value."
18
+
},
19
+
"httpsServerPort": {
20
+
"type": "number",
21
+
"description": "Port the proxy HTTPS server listens on. Can also be set with the GIT_PROXY_HTTPS_SERVER_PORT environment variable, which takes precedence over this value."
22
+
},
23
+
"uiHost": {
24
+
"type": "string",
25
+
"description": "Host of the GitProxy UI. Can also be set with the GIT_PROXY_UI_HOST environment variable, which takes precedence over this value."
26
+
},
27
+
"uiPort": {
28
+
"type": "number",
29
+
"description": "Port the GitProxy UI/service HTTP server listens on. Can also be set with the GIT_PROXY_UI_PORT environment variable, which takes precedence over this value."
30
+
},
31
+
"httpsUiPort": {
32
+
"type": "number",
33
+
"description": "Port the GitProxy UI/service HTTPS server listens on. Can also be set with the GIT_PROXY_HTTPS_UI_PORT environment variable, which takes precedence over this value."
0 commit comments