Skip to main content

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

  1. 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
  1. Install doppler-env in your local development environment:
pip install doppler-env
  1. Define the DOPPLER_ENV environment variable in your IDE, editor, or terminal:
export DOPPLER_ENV=1
  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

doppler_env-0.2.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

doppler_env-0.2.1-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page