Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 590 Bytes

README.md

File metadata and controls

20 lines (13 loc) · 590 Bytes

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.