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

Template config with ENV variables #461

Open
wstarzak opened this issue Jun 9, 2024 · 4 comments
Open

Template config with ENV variables #461

wstarzak opened this issue Jun 9, 2024 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed no-stale No stale

Comments

@wstarzak
Copy link

wstarzak commented Jun 9, 2024

Hello,

Would there be any possibility of creating ENV templating that overwrites yaml variables?
Like:

targets:
  main:
    bucket:
      name: XYZ

Would be able to be overwiritten by setting up: CONFIG_TARGETS_MAIN_BUCKET_NAME variable. As having several yamls where just bucket name varies is making my code messy.

Thank you!

@wstarzak wstarzak added the enhancement New feature or request label Jun 9, 2024
@oxyno-zeta
Copy link
Owner

Hello @wstarzak ,

Thanks for your issue.
For the moment, this isn't supported.

To be honest, I don't know how to do this since target names are totally dynamic.

@wstarzak
Copy link
Author

I think if config is mising in yamls, and you put ENV, this should add new value to array - so at the end new dynamic target should be created

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days

@oxyno-zeta oxyno-zeta added no-stale No stale help wanted Extra attention is needed and removed no-issue-activity labels Jul 22, 2024
@oxyno-zeta
Copy link
Owner

Hello @wstarzak , I tried several times but it doesn't work as you wanted :( .

The project is using Viper to get all configuration files and load values from it.
Environment values are supported but they only override already present values in the YAML files.
This means you cannot create new configuration sections just from environment variables (which is really annoying....)...

I hope the Viper V2 library will have a solution for that. Or I may need to completely change the library to avoid one...

Have a great rest of your day,

Oxyno-zeta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed no-stale No stale
Projects
None yet
Development

No branches or pull requests

2 participants