dominictarr/rc

Parse arrays from env vars to JSON

JAlbertoGonzalez opened this issue · 0 comments

My JSON config needs an array as one of its params.

I'm unable to set that param from the env vars.

Example:

My JSON is:

{
  "customconfig": {
    "arrayparam": []
  }
}

If I use:

prefix_customconfig_arrayparam=example

Result is:

{
  "customconfig": {
    "arrayparam": "example"
  }
}

If I use:

prefix_customconfig_arrayparam__0=example1
prefix_customconfig_arrayparam__1=example2

I get:

{
  "customconfig": {
    "arrayparam": {
      "0": "example1",
      "1": "example2"
    }
  }
}

Is there any way to parse envs params to arrays?