-
Notifications
You must be signed in to change notification settings - Fork 2
Initial Implementation #1
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
base: main
Are you sure you want to change the base?
Initial Implementation #1
Conversation
Hey I'd love to use this library - it's especially useful for AWS Lambda functions. Any word on when this PR might be merged? |
I'd love to see this merged. My org is eager to use dotenvx for Lambda |
encoding = encoding) | ||
|
||
env_keys_values = dotenv.dotenv_values('.env.keys') | ||
dotenv_private_key = env_keys_values['DOTENV_PRIVATE_KEY'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since .env.keys
should be .gitignored, can we assume os.environ['DOTENV_PRIVATE_KEY']
is already set correctly and use it?
hi everyone, this is great BUT any reason you're not just using dotenvx via the binary install? That should work for lambda @Lfooligan, right? Or use python and node together on a lambda and use the npm dotenvx? background: this repo was originally a placeholder with the intention to add a light python wrapper around native extensions. Similar to like |
In support of implementing this library: I ended up writing my own version of this PR in order to "natively" use dotenvx without relying on the binary. It greatly improved the portability of our application in CI, local workflows, etc, while allowing us to take advantage of better secrets management through dotenvx. Counterpoint:
This solution was not easy to discover, though (I couldn't find this via googling and had to ask JetBrains support). In conclusion: it was quicker/easier to implement and use this library than go digging for a way to properly use the binary in PyCharm. So, at least for my use case, this library would have been helpful. |
Summary
This PR implements the
load_dotenvx()
function, which extends the existingload_dotenv()
functionality to decrypt any encrypted environment variables before injecting them intoos.environ
.Changes Made
load_dotenvx()
function insrc/dotenvx/main.py
.python-dotenv
for existing dotenv loading logic.Usage Example