Cannot load config from an external file
BlitzBanana opened this issue · 2 comments
BlitzBanana commented
Hello
I'm facing a problem using external .yml config files in my serverless.yml.
This works:
# serverless.yml
custom:
sentry:
dsn: https://xxxx:yyyy@sentry.io/zzzz
organization: my-organziation
project: my-project
authToken: my-token
release: true
This doesn't work:
# serverless.yml
custom: ${file(staging.yml)}
# staging.yml
sentry:
dsn: https://xxxx:yyyy@sentry.io/zzzz
organization: my-organziation
project: my-project
authToken: my-token
release: true
This doesn't work either:
# serverless.yml
custom:
env: ${file(staging.yml)}
sentry: ${self:custom.env.sentry}
# staging.yml
sentry:
dsn: https://xxxx:yyyy@sentry.io/zzzz
organization: my-organziation
project: my-project
authToken: my-token
release: true
The only solution is:
# serverless.yml
custom:
env: ${file(staging.yml)}
sentry:
dsn: ${self:custom.env.sentry.dsn}
environment: ${self:custom.env.sentry.environment}
organization: ${self:custom.env.sentry.organization}
project: ${self:custom.env.sentry.project}
authToken: ${self:custom.env.sentry.authToken}
release: ${self:custom.env.sentry.release}
# staging.yml
sentry:
dsn: https://xxxx:yyyy@sentry.io/zzzz
organization: my-organziation
project: my-project
authToken: my-token
release: true
serverless-sentry-plugin/src/index.js
Lines 54 to 59 in 1462dff
serverless-sentry-plugin/src/index.js
Lines 76 to 78 in 1462dff
Maybe we could use this._serverless.variables.populateObject()
directly on custom
instead of custom.sentry
(and only if sentry is an object) ?
Katafalkas commented
👍 💯 need this fix too
arabold commented
I don't think this is still a problem in v2.