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

Replace strings in Dancer2 config with environment variables #1629

Closed
wants to merge 2 commits into from

Conversation

mikkoi
Copy link

@mikkoi mikkoi commented Jul 23, 2021

Ref #1628

What this PR changes?

  1. After reading the whole config from different files, it traverses the whole tree and if it sees a string with a substring like "${ENV:SOME_ENV}", it changes it to the corresponding environment variable, if that environment variable is defined.
  2. Before doing 1), it checks if the config item "env_var_replace" is defined and is boolean true. If so, then it executes 1). Otherwise it skips. This is to maintain backwards compatibility.
  3. Unit tests included.

I am using this solution in my build and web application.

Signed-off-by: Mikko Johannes Koivunalho <[email protected]>
Signed-off-by: Mikko Johannes Koivunalho <[email protected]>
@mikkoi mikkoi closed this Jan 15, 2022
@mikkoi mikkoi deleted the apply-env-vars-in-config branch January 15, 2022 15:45
@mikkoi mikkoi restored the apply-env-vars-in-config branch January 16, 2022 10:20
@xsawyerx
Copy link
Member

I see now that this was closed. I commented on the original ticket with a way that I think we can do this in core.

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.

2 participants