Skip to content

go library to set docker secrets as environment variables

License

Notifications You must be signed in to change notification settings

funktionslust/secretsgoenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

secretsGOenv

go library to set docker secrets as environment variables

Usage

package main

import "github.com/funktionslust/secretsgoenv"

func main() {
    // available options
    useDockerDefaultPath := "" // in case of linux /run/secrets
    overwriteExistingEnvVars := true
    envVarPrefix := "DOCKER_"

    // must be executed before accessing affected env vars
    err := secretsgoenv.Load(useDockerDefaultPath, overwriteExistingEnvVars, envVarPrefix)
    if err != nil {
        panic(err)
    }

    // e.g. if the secrets dir contains a file "password" with the content "secret"
    // the env var DOCKER_PASSWORD is now set to secret, no matter what DOCKER_PASSWORD was before
}

About

go library to set docker secrets as environment variables

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages