Reputation: 428
I have an application which uses an environment variable. The environment variable itself is a bunch of numbers with a dot in the middle, e.g. 36478236853794287.234798237543893
, yet it should be interpreted as a string. I want to deploy this application on AWS Lambda using the Serverless framework.
I have set the environment variable in a separate file (secrets.yml
), which is .gitignored:
dev:
MY_ENV_VAR: 36478236853794287.234798237543893
I then included it in serverless.yml
like this:
provider:
environment: ${self:custom.secrets}
custom:
stage: ${opt:stage, self:provider.stage}
secrets: ${file(secrets.yml):${self:custom.stage}}
However, when I print out MY_ENV_VAR
in my application, the log shows it as a scientifically formatted number, like '3.6478236853794287E14'
.
Upvotes: 0
Views: 816
Reputation: 428
The value as defined in the YAML file is being interpreted as a number. Enclose it in single quotes to make it explicit that it's a string:
dev:
MY_ENV_VAR: '36478236853794287.234798237543893'
Upvotes: 2