Updating variables based on environment

Hi,
We have a case where the Config file should be generic across all Environments, and these variables should be changed based on the Environment, such as connectionString or Version number.

Is there any steps in Octopus as such which does this task?

Kind Regards,
Micheal Power

Hi Michael,

Thanks for getting in touch!

There are a few different ways of doing this.

If the values you wish to change are within the appSettings, connectionStrings or applicationSettings elements of the config file, then .NET Configuration Variables would allow you to change the key values by creating a variable within Octopus with the same name and scoping the values to the relevant environments.

If the values you wish to change are in other elements of the config file then Structured Configuration Variables would likely be the better option. This method works similar to the previous one but the variable name defined in Octopus would include the full path to the key e.g. /app/port.

If you need to change the form of the config file for the different environments, such as adding or removing sections, then .NET Configuration Transforms would be the way to go, however, it doesn’t sound like this is the case here.

Regards,
Paul

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.