We are using habitat in our project for a multisite implementation.
Can we setup the ConnectionStrings.config transformation in the Project/common layer of the habitat framework. Is this doable?
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityWe are using habitat in our project for a multisite implementation.
Can we setup the ConnectionStrings.config transformation in the Project/common layer of the habitat framework. Is this doable?
You can do this. You would just need to add the config file to the project and it will get published with the rest of the files and it will overwrite the file in the webroot.
I would question if you should do this tho. The connection strings get set when you install the Sitecore instance. So each developer should already have that set. If you put this file in the project and thus source control, you either need to make sure all devs have the exact same machine setup or they will have to make changes and not commit those.
Also you end up potentially having SQL Server logins stored in plain text. Not something I would be comfortable with. So while you can do it, I would recommend not doing it.
Edit
As an update to the previous answer, I agree totally with @jammykam. If you need to update connection strings per environment, that is where you need to tokenize your values in the source file and then use your release management tool, whether that be Octopus Deploy, TFS Release Manager etc... to substitute those tokens with the real values.
For local development, you can then use a .debug.config
transform and a tool like SlowCheetah to make sure your development values are added. That is how I work with all configs not just the connection strings.