Use array in JSON configuration file in serverless framework

Viewed 402

My serverless framework is trying to set an environment variable, CONFIG, to be contents of a JSON object.

My serverless.yml has this entry:

  environment:
    ${file(./config.json)}

and my config.json looks like this:

{
    "VARIABLE1": "value1",
    "VARIABLE2": "value2",
    "INT_VARIABLE": 3
    "BOOLEAN_TEST": true
}

This seems to work just fine. ie:

console.log(process.env.VARIABLE1) outputs value1

console.log(process.env.INT_VARIABLE) outputs 3 (as a string... but I can convert if needed)

console.log(process.env.BOOLEAN_TEST) outputs true (as a string... but that's not the end of the world)

But when I go to add an array to the config.json, making the config.json look like this:

{
    "VARIABLE1": "value1",
    "VARIABLE2": "value2",
    "INT_VARIABLE": 3
    "BOOLEAN_TEST": true
    "ARRAY_TEST": ["arrVal1", "arrVal2", "arrVal3"]
}

I get the following error:

Warning: Invalid configuration encountered at 'provider.environment.ARRAY_TEST': unsupported configuration format

How can I add an array as a environmental variable in serverless framework? (same basic question about adding sub-objects)

0 Answers
Related