feat(config): Make config elements overridable via environment variable#219
Closed
kreusel wants to merge 1 commit into
Closed
feat(config): Make config elements overridable via environment variable#219kreusel wants to merge 1 commit into
kreusel wants to merge 1 commit into
Conversation
Example for config file (smtp_password will get replaced with value of $SMTP_PASSWORD): ``` [nodemailer] smtp_server = "mail.example.com" smtp_port = "587" smtp_username = "noreply@example.com" smtp_password = "$SMTP_PASSWORD" ```
Owner
|
Ah, this is a lovely idea. I wonder if it would be a bit safer to parse the file as TOML first, and then replace the variables in the output JS object, knowing that they specifically start with a $ symbol. My worry here is what happens if I put a $ symbol in another variable, or in an API key, etc. |
Author
|
Fair point, had that idea too. Will have a look |
halkeye
added a commit
to halkeye/gathio
that referenced
this pull request
Nov 2, 2025
halkeye
added a commit
to halkeye/gathio
that referenced
this pull request
Nov 14, 2025
Owner
Author
|
Great thing 👍 |
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.
As for many (or just my) environments, you do not want to have passwords in configurations that may be stored in a git repository. So i wanted to have a way of configuring env var replacements inside the .toml file without changing to much.
Another possible solution would be to implement a more sophisticated config framework.
Example for config file (smtp_password will get replaced with value of $SMTP_PASSWORD):