'How to handle secrets in a Go function deployed to AWS Lambda

I have a function that works locally and I have a config file that loads into the app using Viper, I also have viper.AutomaticEnv() set.

After deploying to AWS Lambda, seems like env vars are ignored. I went over to the Viper issues page and found this: https://github.com/spf13/viper/issues/584

Looks like Viper requires a config file to load or it will just stop working even though we can set env vars.

How do you handle local dev vs deployment for lambda secrets in Go?

I would like to avoid AWS Secrets Manager if possible



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source