I am writing a Python program that polls various sources and tracks the metrics they output. This clearly has lots of personal credentials, including usernames, passwords and API keys. I want to be able to open source the program, but keep the credentials secret.
At the moment, I have simply got a file called config.py
which contains all the sensitive credentials. I have copied this to a file called EXAMPLE_config.py
and removed all the sensitive information. The first line is
# Add your information to the below then rename this file to config.py
I was planning to put a gitignore
on config.py
and to git
the EXAMPLE_config.py
file. While this works, it does seem a bit inefficient; every time I add a new credential to config.py
, I would also need to add the variable name to EXAMPLE_config.py
.
What is the best way to share this program on via git, on GitHub for example, without sharing the sensitive information? I have seen Configuration files in Python, however this suggests many options. I have also seen Remove sensitive files and their commits from Git history, however I want to prevent the data from ever being shared in the first place. Is there an accepted pythonic or general standard?