2 ms·
Importing the package is what sets the config on the environment. If you'd prefer not to modify the app at all, you could also use EnvKey's bash tool, envkey-s
by danenania 9y ago
Importing the package is what sets the config on the environment.
If you'd prefer not to modify the app at all, you could also use EnvKey's bash tool, envkey-source: https://github.com/envkey/envkey-source https://github.com/envkey/envkey-source
This lets you set the config as OS-level environment variables, and therefore doesn't require adding a library to your app. With an ENVKEY environment variable set, it works like this:
$ eval $(envkey-source)
$ python
>> import os
>> os.environ["SOME_API_KEY"]
- peterwwillis 9y agoUsing the bash tool is a great solution, and is way less technical debt than adding code to an app. I would have the tool execute apps directly rather than export them to bash, though both are useful.
- danenania 9y agoGreat - I'm glad that's a better fit for you :) You can accomplish 'executing an app directly' with a sub-shell like this: $ (eval $(envkey-source) && run-app-command) That way, the variables won't be exported in the parent shell.