Search code examples
octopus-deploy

With Octopus Deploy, is it possible to use variables to changes config values other than App Settings?


We are running OD 1.6.

I'd like to use OD variables to change values such as Session State Provider that aren't in the app settings section.

I know I can use a transform for this, but as a company we prefer to use OD variables as opposed to transforms as it allows our ops team to change settings without changing our codebase.

Is there a way to inject variables into arbitrary places into the web.config?

Something like:

<sessionState mode="Custom" customProvider="#{MyODVariable.SessionStore}">
    <providers>
        <add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="#{MyODVariable.Host}" 
accessKey="#{MyODVariable.AccessKey}" ssl="#{MyODVariable.SSL}" />
    </providers>
</sessionState>

Solution

  • In 2.4+ There is a feature for that but in 1.6 the only way to resolve this would be to write a PowerShell script and do a replace in the file. If you are looking for an example a good place to start would be the PowerShell code found on this library page: http://library.octopusdeploy.com/#!/step-template/actiontemplate-file-system-find-and-replace