Skip to content

Golang package for reading secrets from file and ENV variables.

License

Notifications You must be signed in to change notification settings

ndthuan/secretenv

Repository files navigation

secretenv

This is a Golang package for reading secrets from files and environment variables.

Usage

Inject secrets into your container.

You can optionally specify an environment variable suffixed with _FILE to indicate the location of the secret. For example, DB_PASSWORD_FILE=/run/secrets/db_password.

To read its content:

import "github.com/ndthuan/secretenv"

func main() {
    dbPassword := secretenv.Get("DB_PASSWORD")
}

If DB_PASSWORD_FILE does not exist or there is an error reading it, the value of the environment variable DB_PASSWORD will be returned.

About

Golang package for reading secrets from file and ENV variables.

Resources

License

Stars

Watchers

Forks

Packages

No packages published