Home / Companies / Octopus Deploy / Blog / Post Details
Content Deep Dive

Variable substitution in files with Octopus 2.3

Blog post from Octopus Deploy

Post Details
Company
Date Published
Author
Paul Stovell
Word Count
380
Language
English
Hacker News Points
-
Summary

Octopus Deploy offers robust support for variables that can be scoped to specific machines, environments, and roles, allowing for substitutions in XML and other types of configuration files during deployment. In version 2.3, Octopus extends its variable substitution capabilities to various file types, using a consistent syntax, as demonstrated through a sample application involving a feed monitoring service where server configurations are stored in a JSON file. This process involves using a template file named Config.json.template, which incorporates features like #{each} and #{unless} to dynamically configure server endpoints based on the deployment environment. The deployment feature is straightforward to set up, requiring a list of files for variable substitution and a PowerShell snippet to replace the target file with the template content. This results in an automatically configured JSON file tailored to the specific environment, facilitating seamless deployments.