Skip to content
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

Allow users to declare safe env files in .dotenv-stripout-ignore, whose values won't be stripped #7

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

harrisonpim
Copy link
Owner

@harrisonpim harrisonpim commented Aug 31, 2024

This PR closes #5, following the discussion in #1

It adds the option for users to include .dotenv-stripout-ignore files in their repos, which lists a set of files which should not be stripped. For example:

my_project
├── src
│   └── ...
├── .dotenv-stripout-ignore
├── safe.env
└── unsafe.env

the .dotenv-stripout-ignore file might look like

safe.env

unsafe.env might contain

# here are some comments
# i can add comments however i choose
THIS_VARIABLE_SHOULD_BE_SECRET=
SO_SHOULD_THIS_ONE=

and safe.env might contain

THIS_VARIABLE_IS=okay_to_share
AND_THIS_ONE_IS=too
# also able to add comments in this file, in whatever format I want!

The variables stored in unstripped files should represent public config, ie non-secret values which are safe to share publicly. Adding this feature matches the recommendations in https://12factor.net/config nicely.

In this implementation, the path discovery for patterns listed in the .dotenv-stripout-ignore file(s) approximately matches the behaviour of a .gitignore file. The major changes are made in dotenv_stripout/stripout.py

Note: Before the next release of the package, this PR should be followed by a more complete update to the project's documentation to help users understand the feature.

@harrisonpim harrisonpim marked this pull request as ready for review September 1, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to safely declare environment variables whose values can be publicly shared
1 participant