Octopus Deploy - 1 production environment, but different APIs

Hello - I have two ASP.NET servers - Prod1 and Prod2. Deploying to both is no problem. The issue I have is how to change, within the Web.config file, the api that is pointed to, depending on which environment is deployed to. So, I want my web.config file for prod1 to have api1, and the web.config file for prod2 to have api2. Otherwise, these two environments are the same. How do I accomplish this?

Hi Russell,

Thanks for getting in touch! It sounds like you are after our variable scoping feature.

Octopus lets you “Scope” variables so that you can dynamically control the values they evaluate to in different scenarios.

For example, you can create a single variable APIVariable with two values api1 & api2. You can scope each value of this variable to the different servers.

We have a great documentation page on Scoping Variables.

Here is our documentation on Configuration Transforms, which may also help here.

Finally, our documentation on Substituting Variables in Files. These documentation pages should give you a good idea on how to dynamically configure your configuration files in your deployment.

If you have any further thoughts or questions here, please don’t hesitate to let me know. :slight_smile:

Best regards,

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