This reminded me of a previous discussion at
https://news.ycombinator.com/item?id=22011251 that might be useful to you.
(and FWIW - currently my approach is to require that each environment is config-identical, allowing simple source control to provide the solution - but I appreciate that's probably a property that's very hard to maintain in many environments)