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

[RFC] Allow multiple envvar prefixes. was: Switch env with additional env variables #733

Open
Guo-Zhang opened this issue Apr 1, 2022 · 2 comments
Milestone

Comments

@Guo-Zhang
Copy link

I am wondering whether it exists some simple method to switch the env label with additional env variables.

I am writing a SDK for TencentCloud. I want to the environment variables in the runtime of function computing. A environment variable, "TENCENTCLOUD_RUNTIME"="SCF" , can be used to identify the environment. I hope to use them as additional default value or replace some addtional default value, for example, "TENCENTCLOUD_SECRETID" in replace of SDK's "QCLOUDSDK_SECRET_ID"。

I cannot understand how to use custom loader, or use proper parameters to control settings class.

In addition, the docs have no detailed description about "@str format" and "@JLINA " with env. I cannot find proper ways to deal with more complicated condition, for example, "TENCENTCLOUD_SECRETID" only exists when access role is setted.

@rochacbruno
Copy link
Member

maybe what you are lokking for is dynaconf_hooks? https://www.dynaconf.com/advanced/#hooks

@rochacbruno rochacbruno added this to the 3.2.0 milestone Jun 6, 2022
@rochacbruno
Copy link
Member

Revisiting this issue and IIUC this is an RFC to include something like:

  1. Allow multiple prefixes when loading envvars
settings = Dynaconf(envvar_prefix=["PREFIX1", "PREFIX2"])

and the order of the prefix list defines its precedence, so if both PREFIX1_KEY and PREFIX2_KEY exists, the first has precedence.

On #683 there will be support for setting envvars per variable defined in the schema

@rochacbruno rochacbruno modified the milestones: 3.2.0, 4.0.0 Sep 21, 2022
@rochacbruno rochacbruno changed the title Switch env with additional env variables [RFC] Allow multiple envvar prefixes. was: Switch env with additional env variables Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants