访问Amazon Web Server AWS的无服务器变量的外部文件

时间:2018-04-13 13:57:50

标签: amazon-web-services serverless-framework

我想在无服务器文件中读取外部json文件中的变量。但是我得到了这个错误:

  Serverless Error ---------------------------------------

  Invalid variable reference syntax for variable serverless-gf. You can only reference env vars, options, & files. You can check our docs for more info.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           6.13.1
     Serverless Version:     1.26.1

这是我在serverless.yml中的代码:

provider:
  name: aws
  runtime: nodejs6.10
  profile: ${opt:profile, ${file(./config/serverless_config.json):profile}}
  stage: ${opt:stage, 'dev'}

这是我的./config/serverless_config.json:

{
    "profile":"serverless-gf"
}

谢谢!

0 个答案:

没有答案