Ask environment variable


#1

Hi,
my environment variable is getting “[object object]”

my serverless.yml file is
provider:
environment: {file(secrets-{self:provider.stage}.yml)} ==> load from secrets-dev.yml file

and my secrets-dev.yml file is
status:
ERROR: ‘ERR’
INACTIVE: ‘ACT’
OK: ‘OK’

how can i access status.ERROR ?
i try to print process.env.status it return “[object object]”

i try convert it into the json file also same result

any advice ?

thanks


#2

You can’t assign objects to environment variables. From memory the return value is either a string or undefined.


#3

thanks @buggy for the help. i manage to put it into another file