Thanks for reporting this, it's a feature we had that we lost with the v1. Glad v1.2 puts it back on.
It's not that hard to implement I think, please someone PR.
Hi David,
Actually this feature has one complication. It allows to define per function environmet variables and we are running function calls in the same process.
Hi,
@Leonardo, you are right, but cant't we do an hydrate and clean strategy on
the process.env variable. We put the data before function call and clean
those variables after call.
Anyway, we can just say we don't manage variables conflicts for the first
implementation, since main use cases are different staging levels or
different keys per function.
I might get some time to work on that one next week, and document stage
variables feature :(.
2016-11-23 13:08 GMT+01:00 Leonardo Alifraco [email protected]:
Hi David,
Actually this feature has one complication. It allows to define per
function environmet variables and we are running function calls in the same
process.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/dherault/serverless-offline/issues/161#issuecomment-262497052,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADDOh4rzQPykNBUa-DN1w5kcuGnjFP8ks5rBCzBgaJpZM4K5rDY
.
Would it be possible to implement the provider wide environment variables first and do the hard stuff later? I'm only using the provider wide environment variables... :)
Not to complicate this further, but it is also now possible to do something like this and get environment variables pointing to custom resources:
environment:
AURORA_ADDRESS: { "Fn::GetAtt": [ "AuroraCluster", "Endpoint.Address"] }
AURORA_PORT: { "Fn::GetAtt": [ "AuroraCluster", "Endpoint.Port"] }
This is AWESOME, but I can't think of a good way to support this in offline mode since those values are meaningless outside of the context of AWS Cloudformation.
Ideas?
Would it be possible to use a fallback variable?
custom:
aurora_address: '1.2.3.4'
aurora_port: 3306
environment:
AURORA_ADDRESS: ${ "Fn::GetAtt": [ "AuroraCluster", "Endpoint.Address"], self:custom.aurora_address }
AURORA_PORT: ${ "Fn::GetAtt": [ "AuroraCluster", "Endpoint.Port"], self:custom.aurora_port }
Guys, what's the status of this? We just migrated to 1.3 and our offline usage is completely broken now... :( We don't use variables per function, so doing only the root ones would be good enough for now.
v3.6.0!
@dherault I would raise whether this should be closed as Environment variables per function is not completed?
@nwhite89 Just created #176 for that. Thanks.
Most helpful comment
Would it be possible to implement the provider wide environment variables first and do the hard stuff later? I'm only using the provider wide environment variables... :)