title: Manage configuration files across environments
body: <p>How do you (your company) manage the config-files of the apps/systems you build? Let me tell you how we do it, and what the problem is.</p>
  
  <p>I'm working at a company where we develop software with about 15 developers. We build line-of-business web apps that are deployed at our managed hosting provider.
  One of our main apps consists of one web site and about ten WCF services. Some of the services are connected to each other.</p>
  
  <p>I don't know if this is a big system, or small, but my opinion is that is takes us way too long to get things up and running in our different environments (test, acceptance and production).</p>
  
  <p>We have config-files per environment in our Visual Studio projects. So a <code>web.test.config</code>, a <code>web.acc.config</code>, a <code>web.prod.config</code> and a <code>web.config</code> for development. They all have the same keys in them, but the values can be different, depending on the environment they are meant for.</p>
  
  <p>If I do a quick count of the appsettings in the web.config for the webapp I count 32. And I count 5 endpoints. We have four environments (dev, test, acc and prod) this means 128 appsettings and 20 endpoints in total for one web app. We can easily make mistakes, especially when deadlines are closing in. </p>
  
  <p>We are all humans, so things like this may happen to anyone: </p>
  
  <ul>
  <li>We make a change in one of config files, but forget to check in before we build and deploy. </li>
  <li>Or we make a change on the WebServer and forget to update accordingly in four other web.configs. </li>
  <li>Or we Change only three of four config files. And so on.</li>
  </ul>
  
  <p>Then we have the infrastructure at our managed hosting provider. By default every port is closed. So if one of WCF services needs to talk to other one of WCF services located on a different server, a firewall protected port has to be open. </p>
  
  <p>We do this in Test, but in Acceptance we have to do it again, and we have forgotten which ports have to be opened, so it's more like trial-and-error: Oh my service can't connect to the database, probably the port is closed. The same problem may happen in production as well. </p>
  
  <p>Our managed hosting provider can take a few days to open a port in a firewall, according to the SLA. So, this quickly becomes a pretty long process. And in the end it takes us about two months to have Test, Acceptance and production up and running.</p>
  
  <p>So, my question is: how do you manage the configurations and the infrastructure and the process around it?</p>