Configuration substitution when values don't have a key and are not inside the appsettings

Hello,
I have configsection defined in my app.config as

and I’m using this section in the app.config as

<Clean.TimeToBeAlive value=“somevalue”>

I’m deploying my application into the dev, CI and production environments, and would like to set the value of Clean.TimeToBeAlive to be 10, 18 and 30 respectively. How do I set this through the octopus variables section?

I don’t want to use the variables substitution in files because developers will need to set it everytime while debugging. So I am looking at the configuration variable substitution but all the documentation I see indicates that my config should have something like , which is unfortunately not possible in my case.

Thanks,
Niranjan

seems like my configsection declaration disappeared in the post
was defined as section name=“mysection” type=“someclass, somenamespace” />

HI Niranjan,

Thanks for getting in touch! The configuration variables feature will look only for appSettings, applicationSettings and connectionStrings elements, so you’re correct that this won’t help with this.

A way to handle this could be to still use variable substitution in files feature, but instead of standard project variable, you can set prompted variables which would allow your devs to set the values at deployment time. This works in the same way - target the app.config file in the Target files section, and use the variable substitution syntax where you want the prompted value to be substituted. This would then look like <Clean.TimeToBeAlive value=“#{PromptedVariableName}”>.

Would that give you the outcome you’re looking for? Let me know what you think, or if you have any further questions or concerns moving forward. :slight_smile:

Best regards,

Kenny

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