Skip to content

feat(config): allow server settings via config file with env precedence#1554

Merged
kriswest merged 2 commits into
finos:mainfrom
akagifreeez:feat/server-settings-config
Jun 6, 2026
Merged

feat(config): allow server settings via config file with env precedence#1554
kriswest merged 2 commits into
finos:mainfrom
akagifreeez:feat/server-settings-config

Conversation

@akagifreeez

@akagifreeez akagifreeez commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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 how GIT_PROXY_COOKIE_SECRET already works:

  • Precedence: environment variable (when set) → config file → built-in default.
  • src/config/env.ts now exposes the raw environment values (undefined when unset) so the
    config file can supply the default.
  • New getters getServerPort / getHttpsServerPort / getUIHost / getHttpsUIPort (and
    getUIPort now reads the merged config); the proxy, service, URL helpers and the OIDC auth
    route read these lazily instead of at module load.
  • Also fixes the OIDC callback redirect, which previously fell back to UI port 3000 instead
    of the configured UI port.

Config-file properties added: serverPort, httpsServerPort, uiHost, uiPort, httpsUiPort.

Related Issue

Resolves #1553

Checklist

General

Documentation

  • Documentation has been added/updated (config overview note + regenerated schema reference)

Configuration

  • If configuration schema (config.schema.json) was modified:
    • TypeScript types regenerated (npm run generate-config-types)
    • Schema reference docs regenerated (npm run gen-schema-doc)

Tests

  • Tests have been added/updated for new functionality (default / config-file / env-precedence for the new settings)
  • Unit tests pass (npm test) — 808 passed
  • Linting and formatting pass (npm run lint and npm run format:check)
  • Type checks pass (npm run check-types)

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.
@akagifreeez akagifreeez requested a review from a team as a code owner June 2, 2026 13:48
@netlify

netlify Bot commented Jun 2, 2026

Copy link
Copy Markdown

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 9b4f18a
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/6a22facf80813a0008819de9

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 2, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: akagifreeez / name: akagifreeez (d2f38dc)

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.95775% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.68%. Comparing base (c841444) to head (9b4f18a).

Files with missing lines Patch % Lines
src/service/urls.ts 50.00% 4 Missing ⚠️
src/service/routes/auth.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1554      +/-   ##
==========================================
+ Coverage   90.62%   90.68%   +0.05%     
==========================================
  Files          69       69              
  Lines        5694     5741      +47     
  Branches      985      989       +4     
==========================================
+ Hits         5160     5206      +46     
- Misses        516      517       +1     
  Partials       18       18              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kriswest kriswest left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kriswest kriswest enabled auto-merge June 5, 2026 16:35
@kriswest kriswest merged commit 84a1a8c into finos:main Jun 6, 2026
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow server details to be set through configuration in addition to environment variables

2 participants