How could I achieve this: A (set of) configuration that "knows" whether this is development or live? I want to maintain my configs without worrying about which file to upload where or overwriting essential things. I tried the code below in my mysite/_config.php, but this does not work. Any ideas? Thanks!
Thanks, socks. Not entirely. I have seen this docs, but it only describes how I can spread basic credentials over different developments. I want two set of credentials for the same site. Unless I have overlooked something, the solution is not there.
Socks was on the correct track - if I understand correctly you want dev / live versions of your config file. This is where _ss_environment.php comes into play. You have that file on each of your servers above the web root to define the global states eg like db details.
Things like mysql user, and server go in there as these are usually the same over multiple sites on your host. If you have project specific dev / live differences then you would use a Director::isDev() in the _config of the project usually you have to do this for api keys.
Thanks, but sorry: I don't get that. I wanted to use Director:isDev() and it didn't work. This is why I have posted parts of the _config.php
Unless I misunderstand the obvious, _ss_environment is fine if you have almost identical setting for a number of sites on _one_ server. I have _one_ site on _two_ servers, and I want 1 config file that knows which parts to pick from.
isDev() would be fine - please cf. my excerpt (which didn't work for me).
In your individual _ss_environments (on your dev / live machines) make sure you have set the environment type to dev on your dev box define('SS_ENVIRONMENT_TYPE', 'dev'); and define live on your live site define('SS_ENVIRONMENT_TYPE', 'live'); Once you have set that in your _ss_environment file you can then your code statement should work fine
Even though you have defined Director::set_dev_servers() which should work I prefer to be safe and define the environment type.