First and foremost, welcome to the Octopus forums!
Thanks for reaching out.
Is there any particular reason you’d like to have 3 separate files?
If it works for your use-case, you could have the one appsettings.json file, and then within your project you scope your variables by the environment so the correct variable for each field gets substituted when deploying in that environment.
Thank-you for the warm welcome and the quick response.
There’s no real reason why I would use 3 files. It is part of the question. Should I do so or not? What should I do instead?
What is the recommended way of doing it using Octopus?
I had gone through the documentation you posted but I found nothing that I can apply for my scenario.
It seemed like a standard scenario since it’s officially supported, so I guessed that we are failing to understand or find the right documentation on how to implement it properly
If it works for your use-case, you could have the one appsettings.json file, and then within your project you scope your variables by the environment so the correct variable for each field gets substituted when deploying in that environment.
Could you please take me through how I should do this, by example? Step by step?
I think it’s probably simplest to just use one appsettings file and scope your variables.
Here is a barebones example:
Step Settings:
First you will need to click Configure Features within your Deploy a Package(or whichever youre using) step and enable “Structured Configuration Variables”. After that, you will need to put in the location and name of the file. Like it says in the tooltip, you can be as specific or as vague as you’d like using wildcards. For my example I just chose any folder, but the name is appsettings.json
Variables within the project:
You will see I have 2 variables, but both variables have 3 separate values. Each value within those variables is scoped to an environment. What this does is it only makes that specific value available to the deployment depending on which environment is currently being targeted by the deployment.