Environment & Config File Names for Config Transform

When doing config transforms during the Deploy Package step, I know that Octopus implicitly checks for ENV.config files (where ENV is the same literal name as the Octopus environment) to do the transforms. A question here: is there any way to have ENV.config file that isn’t the same name as the Octopus environment.

E.g., if my config is called “Web.QA.config”, but my environment gets rename from “QA” to “QA-temp”, then does my config need to be renamed to “Web.QA-temp.config” as well? Or is there some way during the Deploy Package step to map these names to environments?

Thanks.

Hi Jafar,

Thanks for getting in touch! When you are defining your files that need to be transformed, you are able to specify a variable. For example, in your case you want your Web.config to be renamed based on environment. To achieve this, you can use the following variable.

Variable - EnvironmentConfig | Value - Dev | Scope – Dev
Variable - EnvironmentConfig | Value - Test | Scope – Test
Variable - EnvironmentConfig | Value - QA | Scope – QA

If I was to use the variable #{EnvironmentConfig} Octopus would evaluate the variable to what ever environment you are currently deploying to. So if you are deploying to the Test environment, the substitution would end up as Web.Test.config

Anyway, we have some fantastic documentation on configuration files and how they are handled in Octopus: http://docs.octopus.com/display/OD/Configuration+files

Let me know if that helps or if you have any further questions. :slight_smile:

Best regards
Daniel

Hi Daniel,

This sounds like it will work for me. I’ll give this a try.

Thanks!
Jafar

Hi Jafar,

Let me know if you run into any issues.

Best regards,
Daniel