ejson

package
v1.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name is the Provider name
	Name = "ejson"

	// KeyPairEnvSeparator is the separator between key pairs in the KeysEnvVar
	KeyPairEnvSeparator = ":"

	// KeyPairSeparator is the separator betwen a public and private key in the KeysEnvVar
	KeyPairSeparator = ";"

	// FilesEnvVar is the environment variable holding the ejson file list
	FilesEnvVar = "EJSON_FILES"

	// KeysEnvVar is the environment variable holding the ejson public / private key pairs
	KeysEnvVar = "EJSON_KEYS"
)

Variables

View Source
var EnvVars = map[string]string{
	"EJSON_FILES": `If EJSON_FILES is set, will iterate over each file (colon separated), attempting to decrypt using keys
from EJSON_KEYS. If EJSON_FILES is not set, will look for any .ejson files in CWD. Cleartext decrypted
json will be parsed into a map[string]string and injected into Environ.
e.g. EJSON_FILES=/path/to/file1:/path/to/file2:...`,
	"EJSON_KEYS": `Colon separated list of public/private ejson keys. Public/private keys separated by semicolon.
e.g. EJSON_KEYS=pubkey1;privkey1:pubkey2;privkey2:...`,
}

EnvVars is a map of known vonfiguration environment variables and their usage descriptions

Functions

func New

func New() (environ.Provider, error)

New returns a new Decoder instance or an error if configuring failed. If no ejson files are listed in FilesEnvVar, then will search in CWD for .ejson files

Types

type Decoder

type Decoder struct {
	Files    []string   `env:"EJSON_FILES" envSeparator:":"`
	KeyPairs KeyPairMap `env:"EJSON_KEYS"`
}

Decoder is an github.com/lumoslabs/vestibule/pkg/environ.Provider which accepts a list of ejson files and public/private key pairs. Using these and github.com/Shopify/ejson it decodes the files and adds them to a github.com/lumoslabs/vestibule/pkg/environ.Environ

func (*Decoder) AddToEnviron

func (d *Decoder) AddToEnviron(e *environ.Environ) error

AddToEnviron uses github.com/Shopify/ejson to decrypt the given ejson files using the provided key pairs. Cleartext file data is decoded into map[string]string objects and merged with the provided environ.Environ

type KeyPairMap

type KeyPairMap map[string]string

KeyPairMap is a map[string]string that holds a map of ejson public / private key pairs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL