Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(services/config): Add ability to set Trilium configuration variables via ENV variables #1036

Merged
merged 11 commits into from
Jan 26, 2025

Conversation

pano9000
Copy link
Contributor

@pano9000 pano9000 commented Jan 23, 2025

Hi,

this PR is a continuation of @perfectra1n's PR #1031

It allows users to set the currently defined values via env variables (new!), config.ini (as before) or use fallback values (semi-new!).

The order is:
ENV > config.ini > fallback values

as @perfectra1n mentioned in the matrix Development channel, there still are a couple of env vars, scattered around, that are currently not part of this config file.
Let's split that out into a separate task though – this PR only concentrates on the ones that can be mapped to values in the config.ini file

Also some additional clean up will be necessary, e.g. in port.ts, but will split that out to separate task as well.

big thanks to @perfectra1n for letting me take over here!

edit:

once this PR is merged, TriliumNext/Docs#125 can be adjusted slightly and then merged as well

this also closes #438

pano9000 and others added 11 commits January 23, 2025 20:18
turns "true" / "false" strings from a process.env property into actual boolean values or undefined
envToBoolean used to turn "string booleans" into JS booleans
these are used in the codebase, but are not defined in the sample.ini
original idea of using config-sample.ini for default values
is not backwards compatible unfortunately

fallback values taken from config-sample.ini and directly from other code in this codebase, where these values were set
this is now handled in config.ts already
… consistency

backwards compatibility ensured, by still checking the iniConfig for the old value first
Copy link
Contributor

@eliandoran eliandoran left a comment

Choose a reason for hiding this comment

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

LGTM.

@eliandoran eliandoran merged commit e4b186c into develop Jan 26, 2025
5 checks passed
@eliandoran eliandoran deleted the feat_env-config branch January 26, 2025 12:32
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.

(Feature request) Support configuring trustedReverseProxy via environment variables
3 participants