It doesn't seem to be possible to create a pipenv shell
and source vars from some executable in addition to .env.
When I run pipenv shell
I'd like it automatically do something like source secrets.py
or source secrets.sh
to acquire env vars that are encrypted secrets. I am hoping to do that so I don't have to store a secret on disk (like in .env)
Not sure of any.
I'm interested in pulling some secrets from Hashicorp Vault / Ansible Vault and making them available as environment variables without them ever touching the disk. Even temporary existence on disk creates more opportunity I'd like for an attacker to kill a process before it gets cleaned up
+1, this is also something I would find useful and should be fairly trivial to implement.
I had a skim over the relevant code and might put a PR together.
A better approach would be to allow passing arbitrary arguments to the underlying shell when pipenv launches it. This would enable things like (assuming your shell is Bash; most shells have similar mechanism)
pipenv shell -- --rcfile <(echo 'source ~/.bashrc; source secrets.sh')
which the user has complete control over.
This is well supported by pipenv shell -- --rcfile <(echo 'source ~/.bashrc; source secrets.sh')
, the arguments passed to pipenv shell
depend on what shell you are using.