Performing substitutions of structured configuration variables inside war

I need to perform a variable substitution into an .xml file which is inside a war file deployed to Tomcat. What’s the best way to do this?


In 2020.4, we released a new feature Structured Configuration Variables. This allows you to define variables in Octopus for JSON, YAML, XML, and Property configuration files.

To enable this feature check out our docs here. We also have a sample that uses this feature here.

I hope this answers your question but if you need further help let me know.



Hi Adam
That’s exactly what I want to you and I had it configured from the beginning. My problem is that the file I want to perform subtitutions using Structured Configuration Variables, is inside .war file I’m deploying. So I wonder how I can tell octopus to replace variables with values inside war file


Thanks for getting back to me.

Just to confirm, have you enabled Structured Configuration Variables on the deploy package step? If so, you can then specify configuration files inside the package you are deploying, like the screenshot below, and Octopus will replace the configuration file values inside the .war package. The package type is irrelevant, and this feature works the same for .war, .jar, .zip, or .nupkg.

If you have tried this and it’s not working let me know and I’ll help out :slight_smile:


I’m having xml file inside war file which is in .zip package. I’m deploying .zip package, so the path to xml file would be:


If the .war is contained inside a zip file, then the structured variable replacement probably won’t work for any files inside the .war as this will need to be extracted as well. By default Octopus will extract the .zip but not unpackaged the .war.

So I can understand your use case a little better, why is the .war wrapped inside a .zip file?


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