Inject Doppler secrets as environment variables into your Python application during local development with debugging support for PyCharm and Visual Studio Code.
Project description
doppler-env
Inject Doppler secrets as environment variables into your Python application during local development with debugging support for PyCharm and Visual Studio Code.
How it works
Debugging support in PyCharm and Visual Studio Code is provided by a vendor-specific Python entry-point which prevents the Doppler CLI from being used to directly inject secrets.
This limitation may force developers to use insecure practices such as saving secrets to an unencrypted .env
file—the issue Doppler was created to prevent.
Simply set the DOPPLER_ENV
environment variable, and the doppler-env
package will fetch your secrets using the Doppler CLI, injecting them as environment variables before executing your Python code.
All this while ensuring secrets never touch the file system.
Requirements
Ensure you have installed the Doppler CLI and created a project in the Doppler dashboard.
Then in a local terminal, authorize the Doppler CLI to retrieve secrets from your workplace:
doppler login
Getting started
- If you haven't already, open a new terminal window, change into the repository folder, then configure the Doppler CLI by selecting the project and config to supply secrets for:
doppler setup
- Install
doppler-env
in your local development environment:
pip install doppler-env
- Define the
DOPPLER_ENV
environment variable in your IDE, editor, or terminal:
export DOPPLER_ENV=1
- Run or debug your application in your IDE, editor, or terminal:
python src/app.py
Acknowledgements
This approach to injecting environment variables was inspired by patch-env and customized to be Doppler specific.
Issues
For any bug reports, issues, or enhancements, please create a repository issue.
Support
Paid subscribers can use in-product support while those on Doppler's free community plan can receive help in our Community forum.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for doppler_env-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c7dded46c4fa645e48fdf06fcd04e0fd0e0515ce532a74910d8420eb81b115e |
|
MD5 | 4cfab17b39480dfb8618f4a6ff1f21fd |
|
BLAKE2b-256 | 2ea8c4ac65c29df0fdfbf0c7561cd172b2e812c542361716ffbe47a82541d993 |