3

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

Md. Parvez Alam
  • 4,326
  • 5
  • 48
  • 108

1 Answers1

2

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

Mina Luke
  • 2,056
  • 1
  • 20
  • 22