serverless-mysql
serverless-mysql copied to clipboard
Pick DB Host based on environment
I have multiple "environments" setup for Lambda. One for staging and one for production etc. The DB host is different for each environment. If the mysql configuration needs to be outside the lambda handler, how can i inform it about the environment it's being invoked in? and subsequently the host/db configuration to use?
The environment is usually passed through the context parameter in the aws handler code. Any ideas on how to solve that?
I guess the solution is to run the configuration code inside the handler?
if your using lambda#edge use ssm, if your using lambda you can use env variables.
@aj0y have you solved it? facing simillar issue here
Hey @aj0y, thanks for opening this issue!
You should take a look at this comment.
It contains a snippet that can help you achieve exactly what you're looking for.