Md. Parvez Alam
Md. Parvez Alam

Reputation: 4596

Serverless variable from external file nested property

I have serverless yml and a config file

config file

 app: {
   port: 3000,

 db: {
   connectionString: 'xxxxx'
 },
  lambdaDeploy:{
   stage : "DEV",
   region : "es-west-1"
 }

Trying to use these variables in yml like below

yml

provider:
  name: aws
  runtime: nodejs6.10
  stage: ${file(./appconfiguration.json).app.stage}
  region: ${file(./appconfiguration.json).app.region}

But its reading and taking default

Please advise. Thanks

Upvotes: 3

Views: 859

Answers (1)

Mina Luke
Mina Luke

Reputation: 2171

The syntax used here is not correct.

stage: ${file(./appconfiguration.json).app.stage}

Use colon instead:

stage: ${file(./appconfiguration.json):app.stage}

More details here: https://www.serverless.com/framework/docs/providers/aws/guide/variables/#reference-variables-in-other-files

Upvotes: 2

Related Questions