Where should environment-specific configs be placed in Helix (Habitat) compliant solution (in the VS solution and the file system), such as connection strings?
2 Answers
I would say that these are the files specific for the Project layer so they should be placed in a module there. I would expect a project representing a Website there so I would add them in such a project.
From the Helix docs:
The Project layer provides the context of the solution. This means the actual cohesive website or channel output from the implementation, such as the page types, layout and graphical design. It is on this layer that all the features of the solution are stitched together into a cohesive solution that fits the requirements.
Be careful about the governance process around environment specific configuration. The Helix documentation contains a whole section around configuration and value scope (which circumstances makes a config value change) as well as deployment.
The files in version control and visual studio are typically maintained in the development process, whereas environment specific configuration should be maintained as part of the deployment process.
Output from the development process should be an environment-agnostic, versioned package. This package can then be deployed onto multiple environments and the environment specific configuration then applied.
If you store environment specific configs as part of your solution in version control, you would effectively have to deploy a new version of your solution in case of a change in any environment (dev, test, staging, production).
Therefore, the recommendation is to keep only the development environment configuration in version control - as part of each module (or overall configuration in the project layer modules) - and then manage environment-specific configuration as part of the deployment process, e.g. as part of an automated deployment tool like Octopus.
Read more in the deployment section in Helix
-
Agreed. Keeping your environment configuration (and scripts) separate from your application code is also keeping with the tenants of Continuous Delivery. Mar 2, 2018 at 8:16