3 ms·
Doesn't really make sense. Why are you importing this package if you're getting the creds via environment? Why wouldn't you just load the creds into the environ
by peterwwillis 9y ago
Doesn't really make sense. Why are you importing this package if you're getting the creds via environment? Why wouldn't you just load the creds into the environment with an external tool, and then just run your app, and never have to modify your app in the first place?
- danenania 9y agoImporting 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.