Say my application has a configuration files in plain-text. They contain some sensitive information which is required to test the application in my dev environment. I use different OSes to access and work on my projects (win, mac, … ).
I do not wish some of the information in the configuration files to make it to my public git repository. In best case I want the sensitive information to be replaced with placeholders and have the configuration files uploaded to the repository to keep track of their structure.
How would you approach the problem?
The hook itself wouldn’t be much of a problem for me to write. I’m more interested how to tie it all together, possible directory structure, etc. I’m quite new to git.
There’s a convention followed in the Django world that you could use – there is a standard
settings.pyfile that imports alocal_settingsmodule at the end if there is one available.Have all your secret stuff in that
local_settings.pyfile and add it to.gitignoreso that it doesn’t go to the repository. This way, people will know that they can add their own settings tolocal_settings.For example,
settings.py:local_settings.py:The best part is that whatever you’ve defined in
settings.pywill get overridden by the same name inlocal_settings.py.