Custom script is required to replace config values in configSections?

Hi -

  1. I have values that need to be replaced which are located in configSections as opposed to appSettings or connectionStrings. From reading the other posts, it looks like I will need to write a custom PowerShell script to transform these - correct?

So for example in the configuration snipped below, is it true that I would have to write a PowerShell script to replace the connectionString in the DomainConfig entry or is there some other way to do it?

  1. Assuming this is the case - how can PowerShell know where the config files are installed? The built-in variables don’t appear to work.

    This just prints null

    Write-Output $OctopusParameters[“Octopus.Action.Package.CustomInstallationDirectory”]

<configuration>
  <configSections>
    <section name="DomainConfig" type="SomeApp.NHibernate.DomainConfig, SomeApp"/>
  </configSections>

  <DomainConfig
      ConnectionString="Data Source=.;Initial Catalog=qc_core;Integrated Security=SSPI" />
</configuration>

Your page stripped off my sample config in the post above:

I will try again using square brackets instead of greater/lesser

[configuration]

[configSections]
[section name=“DomainConfig” type=“SomeApp.NHibernate.DomainConfig, SomeApp”/]
[/configSections]

[DomainConfig
ConnectionString=“Data Source=.;Initial Catalog=qc_core;Integrated Security=SSPI” /]

[/configuration]

Hi Jon,

I believe this is what you are looking for for part 1 of your question:


We also have another discussion in progress regarding this issue that might be of help:
http://help.octopusdeploy.com/discussions/questions/2610-complex-webconfig-variable-replacement

As for part 2 I believe I answered that in a different post, regarding step variables and how to access them, but just to link it in here also:

Hope this helps

Vanessa

That’s awesome! Thanks.