envsecrets
"envsecrets" is a meta framework for environment variable loader. It is designed to load environment variables from various sources.
Installation
$ go get github.com/mackee/envsecrets
Usage
If you want set from AWS Secrets Manager, you should set environment variable like below.
export <SECRET_ENVNAME>=secretfrom:aws_secretsmanager:<secret-name>
If set a json value to the secret, you can access the value by specifying the key.
export <SECRET_ENVNAME>=secretfrom:aws_secretsmanager:<secret-name>.<key>
Load environment variables
import (
"github.com/mackee/envsecrets/dist/aws"
)
func main() {
ctx := context.Background()
if err := awsenvsecrets.Load(ctx); err != nil {
log.Fatalf("failed to load environment variables: %v", err)
}
}
Supported sources
✅: Implemented
🔍: Not implemented yet
Source |
Type |
Description |
Status |
AWS Secrets Manager |
aws_secretsmanager |
Load secret from AWS Secrets Manager |
✅ |
AWS Systems Manager ParameterStore |
aws_ssm |
Load secret from AWS Systems Manager ParameterStore |
🔍 |
Amazon S3 |
aws_s3 |
Load secret from Amazon S3 |
🔍 |
Google Cloud Secret Manager |
google_secretmanager |
Load secret from Google Cloud Secret Manager |
🔍 |
1Password |
onepassword |
Load secret from 1Password |
🔍 |
License
Copyright (c) 2024- mackee
Licensed under MIT License.