Chris Payne
Chris Payne

Reputation: 1710

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>

Upvotes: 3

Views: 1877

Answers (2)

Richardissimo
Richardissimo

Reputation: 5765

Clearly the question was written a long time ago, for what is now an old version. In case anyone with a more recent version arrives here...

You can use a transform file containing Octopus variables. Choose Configure Features to enable replacing variables in that file (you have to tell it which file), and to enable applying the transform (use the naming convention, or tell it what you want).

You can then add the community-contributed steps to find unreplaced variables (tick the box to Treat as an error, so the deployment fails if a variable has been missed) and remove transform files.

Upvotes: 0

Vanessa Love
Vanessa Love

Reputation: 96

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

Upvotes: 8

Related Questions