Most of the time, I store development application config in root directory of the project, like this:
app |-- config.json
But that doesn't seem to be the best approach, since this config ends up being stored in version control system - possibly resulting in leaked usernames, passwords and other sensitive stuff.
12 Factor App guide recommends dropping config files altogether and using environment variables for configuration setup:
... stores config in environment variables. Env vars are easy to change between deploys without changing any code; unlike config files, there is little chance of them being checked into the code repo accidentally; and unlike custom config files, or other config mechanisms such as Java System Properties, they are a language- and OS-agnostic standard.
That sounds really nice to me, but where does one store said environment variables, without checking them into source control? And what tools can I use to pass those variables to the app? There can be dozens of config options, and typing them by hand each time you launch the app is not nice - so they have to be stored in some kind of file somewhere. Said file thus will end up in source control, and we return back to where we started.
Is there some universally accepted way of handling configuration options, that doesn't have the risk of storing local configuration in source control?
.gitignorewhere I can define files or folders that should not be checked into version control. As you say I don't see where Env vars should really help, eith you have a script to set them and should be stored together with the project or you have them 'somewhere' on your system (home directory or even in the machines startup scripts) which seems to create a whole lot of problems on its own, especially if a lot of configuration is necessary. In any case I would split the config files so that confidential information go in different files.