-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
Passing config using environment variables #99
Comments
I use env variables to populate traitlets in a few projects (e.g.). I've thought about a way to support it officially in traitlets, but I haven't though of a way that ends up being better than what already works right now: a one-line default generator that reads a given env. |
What about just enshrining this common pattern as universally-supported behavior? For example:
The expected behavior here would be that this behaves equivalently to:
|
I think that should work. |
(I'm writting it here, because is a general discussion, not related to proposed PRs) On #246, Carreau wrote:
I want to put my (light)weight on it: generally programs (e.g.
So far, command-line argument take precedence over config-files because they are merged on top of them. Am i correct to worry? |
+ Respect precendance rules laied in ipython#99 (comment)
+ When getting trait-value, try 1st env-var, then fallback to defaults.
+ Don't load config-values on traits with existing ENV-VAR. + Print ENV-VAR used in class-help, config and RsT msgs. + Add/update TCs.
+ Cmd-line configs override ENV-VARS + Add/update TCs.
+ When getting trait-value, try 1st env-var, then fallback to defaults.
+ Now FIX app.ipython#99 respecting CFG < ENV < CLI order. + Add config & app layer TCs.
This came up again in jupyter/nbconvert#2026 I've came up with this in the config file:
I believe we might be able to adapt it by pulling the My main concern is how could this be abused and could it be a security risk ? My thoughts is that it is more common to give write access to env variables to users than access to CLI flags. |
See #856 as a prototype of how this could work. I'd appreciate reviews. |
Hello,
I'm using Travis-CI for Continuous Integration in many projects.
I'm planning to use traitlets as a way to configure some tools (passing API_KEY, ...)
To be able to test my projects, I need to pass some settings using environnement variables (only for Continuous Integration) because it's necessary to "hide" (from Git repository) some config data (API_KEY, password...)
see http://docs.travis-ci.com/user/environment-variables/
Is it something which is possible with traitlets ?
Is it something which could be considered in traitlets ?
Kind regards
The text was updated successfully, but these errors were encountered: