/docker-secrets

A go (golang) package to read docker secrets.

Primary LanguageGoMIT LicenseMIT

docker-secrets

GoDoc Go Report

Requirements

Go 1.2 or above.

Installation

Run the following command to install the package:

go get github.com/ijustfool/docker-secrets

Usage

package main

import (
    "fmt"
    "github.com/ijustfool/docker-secrets"
)

func main() {
    dockerSecrets, _ := secrets.NewDockerSecrets("")

    // Get all secrets
    fmt.Println(dockerSecrets.GetAll())
    // print: map[secret_1:val_1 secret_2:val_2]

    // Get a single secret
    secret, _ := dockerSecrets.Get("secret_1")
    fmt.Println(secret)
    // print: val_1

    // Custom location
    dsCustomLoc, _ := secrets.NewDockerSecrets("/run/myCustomLocation")
}