Using Variables to replace AppSettings arrays?

pc2's Avatar

pc2

19 Feb, 2018 01:34 PM

Hi,

I'm looking to create variables in our deployment to replace the following configuration from our AppSettings file, however I can't figure out how to do this without it being a single variable. Is it possible to use multiple variables with each one replacing one of the objects within the array?

"ProviderConfiguration": [
{
      "Name": "Service1",
      "Id": "C591124F-9B97-4B50-8C19-F3F41A4D805C",
      "Category": 1,
      "ProductType": 7
    }
    ,{
      "Name": "Service2",
      "Id": "FBBBEECF-9447-474B-BBE5-AF5F71DE14A0",
      "Category": 1,
      "ProductType": 8
    }
    ,{
      "Name": "Service3",
      "Id": "1E81BE66-B3DD-4873-9687-5D467676FE8F",
      "Category": 2,
      "ProductType": 25
    }
    ,{
      "Name": "Service4",
      "Id": "3b7b0304-e888-4e1c-ae17-2b34cf45c9f7",
      "Category": 3,
      "ProductType": 0
    }
    ,{
      "Name": "Service5",
      "Id": "BE1F040A-1FFA-404F-B79B-259C79846953",
      "Category": 4,
      "ProductType": 12
    }
  ]
  1. Support Staff 1 Posted by Reece Walsh on 20 Feb, 2018 05:18 AM

    Reece Walsh's Avatar

    Hi,

    Thanks for getting in touch,

    Based on the information you have provided, it sounds like utilizing the Configuration Files feature would be helpful.

    It's also worth mentioning that using this feature Octopus can replace variables that exist outside of appSettings, applicationSettings, and connectionStrings

    I'd recommend reading through the associated documentation to familiarize yourself with this feature if you are not already.

    If I've misunderstood your request in any way, or you require more specific assistance with this feature please let me know :)

    Have a great day!

    Kind Regards,

    Reece

  2. 2 Posted by pc2 on 20 Feb, 2018 09:59 AM

    pc2's Avatar

    Hi Reece,

    Thanks for the information I'll take a read over it.

    Just to clarify my original question a bit more.

    If my config was

    "ProviderConfiguration":
    {
          "Name": "Service1",
          "Id": "C591124F-9B97-4B50-8C19-F3F41A4D805C",
          "Category": 1,
          "ProductType": 7
    }
    

    then the variables names setup in Octo would be:

    ProviderConfiguration:Name
    ProviderConfiguration:Id
    ProviderConfiguration:Category
    ProviderConfiguration:ProductType
    

    Given my config is an array is there anyway to do something like the following with the variables names:

    ProviderConfiguration[0]:Name
    ProviderConfiguration[0]:Id
    ProviderConfiguration[0]:Category
    ProviderConfiguration[0]:ProductType
    ProviderConfiguration[1]:Name
    ProviderConfiguration[1]:Id
    ProviderConfiguration[1]:Category
    ProviderConfiguration[1]:ProductType
    

    Thanks,

    Chris.

  3. Support Staff 3 Posted by Reece Walsh on 22 Feb, 2018 05:23 AM

    Reece Walsh's Avatar

    Hi Chris,

    Thanks for getting back to me regarding this, I appreciate your patience.

    This should definitely be possible, I've included a link to our documentation regarding variable substitution syntax when performing index replacements.

    I hope this helps!

    Let me know if you require any assistance moving forward :)

    Kind Regards,

    Reece

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac