Skip to content

Commit

Permalink
Make logging configurable and disabled by default (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-blunden authored Dec 8, 2022
1 parent 2b95f70 commit 8bccc28
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
- Check that Doppler CLI is installed
- Add support for CLI and Personal tokens
- Improved README
- Fix paths issue preventing wheel build on Windows
- Fix paths issue preventing wheel build on Windows

## 0.3.1 December 8, 2022

- Logging is now disabled by default and can be enabled by setting the `DOPPLER_ENV_LOGGING` environment variable.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# doppler-env

The doppler-env package automates the injection of Doppler secrets as environment variables into any Python application and works in the terminal, PyCharm, and Visual Studio Code.

## Motivation

The Doppler CLI provides the easiest method of injecting secrets into your application:
Expand Down Expand Up @@ -35,6 +36,12 @@ First, define the `DOPPLER_ENV` environment variable in your IDE, editor, or ter
export DOPPLER_ENV=1
```

You can enable logging for troubleshooting purposes by setting the `DOPPLER_ENV_LOGGING` environment variable:

```sh
export DOPPLER_ENV_LOGGING=1
```

Then configure which secrets to fetch for your application by either using the CLI in the root directory of your application:

```sh
Expand All @@ -55,6 +62,8 @@ In restrictive environments where the use of the Doppler CLI isn't possible, set


```sh
export DOPPLER_TOKEN='dp.st.dev.xxxxxxx'

python app.py

# >> [doppler-env]: DOPPLER_ENV and DOPPLER_TOKEN environment variable set. Fetching secrets from Doppler API
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='doppler_env',
version='0.3.0',
version='0.3.1',
python_requires='>=3.6',
description='Inject Doppler secrets as environment variables into your Python application during local development with debugging support for PyCharm and Visual Studio Code.',
long_description=open('README.md').read(),
Expand Down
5 changes: 4 additions & 1 deletion src/doppler_env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

from dotenv import load_dotenv

LOGGING_ENABLED = True if os.environ.get('DOPPLER_ENV_LOGGING') is not None else False


def log(message):
print('[doppler-env]: {}'.format(message))
if LOGGING_ENABLED:
print('[doppler-env]: {}'.format(message))


def print_debug_info(doppler_token=None, project=None, config=None):
Expand Down

0 comments on commit 8bccc28

Please sign in to comment.