Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define an array as an environment variable for App Settings [duplicate]

How to define environment variables in the app settings of an azure app service to override a list such as the following?

"reportsSettings": {
    "emails": [
      "[email protected]",
      "[email protected]",
      "[email protected]"
    ]
}

ps: I know I could turn the list into a string with a separator that my code would split like

"reportsSettings": {
    "emails": "[email protected]",[email protected],[email protected]"
}

and then use an environment variable defined like that: key => reportsSettings:emails value => [email protected]",[email protected],[email protected]

but I'm trying to see I can keep the json as a list.

like image 450
François Avatar asked Aug 01 '18 06:08

François


1 Answers

You can do this by appending the index after the key:

reportsSettings:emails:0      ===>    [email protected]
reportsSettings:emails:1      ===>    [email protected]
reportsSettings:emails:2      ===>    [email protected]

Here how it looks like in the portal

enter image description here

like image 85
Martin Brandl Avatar answered Oct 18 '22 08:10

Martin Brandl