This module lets you use values in AWS Parameter Store as environmental
variables without modifying your code (other than importing this
module).
Usage Example
Say you have an app like so:
package main
import (
"os"
_ "github.com/oxplot/ssmenv/autoload"
)
func main() {
token := os.Getenv("GITHUB_TOKEN")
// Call some github APIs
}
Let's assume you want to run this code under AWS Lambda but don't want
to specify the token in plain text for security reasons. With this
module imported, you can specify the SSM Parameter's ARN as the value of
GITHUB_TOKEN
env var:
export GITHUB_TOKEN=arn:aws:ssm:us-west-2:1234567890:parameter/github_token
Provided you have assigned appropriate IAM permissions to allow reading
the above parameter from your lambda function, value of GITHUB_TOKEN
env var will be set automatically without any other change to the code.