Open franciscocpg opened 6 years ago
Thank you for the plugin.
When all functions have same handler is another case where environment is messed up. Below is the sample config.
function1: handler: file.handler environment: ENV1: 'fn1 env1 value' environmentSecrets: ENVSECRET1: '/my-project/${opt:stage}/ENVSECRET1'
function2: handler: file.handler environment: ENV1: 'fn2 env1 value' environmentSecrets: ENVSECRET1: '/my-project/${opt:stage}/ENVSECRET2'
If we can generate environments object by function name instead, it would be a more generic fix.
Prepared PR to fix this issue - https://github.com/trek10inc/serverless-secrets/pull/38.
Giving the following serverless configuration
When invoking
function1
the environment is injected withENV2
variable instead ofENV1
. And that's because of the the code below: https://github.com/trek10inc/serverless-secrets/blob/948e5db949dc63cc0b2cac6486c1a5c9c41e9589/plugin/index.js#L240-L247I've done a fix for me (https://github.com/franciscocpg/serverless-secrets/commit/19140522150c3e9aeac16c879e586d6ceb607964) and it worked the way I've expected but before proposing a PR I'd like to know the rationale behind this split.
Maybe there is something I'm not seeing.