env

package
v0.0.0-...-536019a Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFormat output envar like <NAME> = <VALUE>
	DefaultFormat = "kv"
)

Variables

View Source
var (
	// AwsselDefaultEnvvarsLimit is the max number of values
	// that it is retrieved from the SSM store
	AwsselDefaultEnvvarsLimit int = 100
)

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	Format(ev Var) string
}

Formatter is used to format an env var

func BashExportFormatter

func BashExportFormatter() Formatter

BashExportFormatter return an instance of the bashExportFormatter This exporter prefix the output with the bash 'export' statement

func DefaultFormatter

func DefaultFormatter() Formatter

DefaultFormatter creates a new Defaultformatter

type SSMStore

type SSMStore struct {
	// contains filtered or unexported fields
}

SSMStore is an implementation of a store. It is used to query SSM Parameter store

func NewSSMStore

func NewSSMStore(o ...SSMStoreOptions) *SSMStore

NewSSMStore returns a client to query AWS SSM Parameter Store It use a SSMStoreOptions as a parameter to pass info needed by the store

func (*SSMStore) QueryVarsForService

func (s *SSMStore) QueryVarsForService(name string, opts ...StoreQueryOptions) ([]*Var, error)

QueryVarsForService is used to query SSM Parameter Store It returns all env vars related to a given service. or and error if something went wrong

See env.StoreQueryOption for more information about available options

type SSMStoreOptions

type SSMStoreOptions struct {
	Region string

	Endpoint string
	// contains filtered or unexported fields
}

SSMStoreOptions gather information need to create a session with the AWS SSM service

type StoreQueryOptions

type StoreQueryOptions struct {
	FilterPattern string
	PrefixPath    string
}

StoreQueryOptions contains additonnal options needed to query a store

type Storer

type Storer interface {
	QueryVarsForService(serviceName string, opts ...StoreQueryOptions) ([]*Var, error)
}

Storer is the API that any Store implementation must satisfy

type Var

type Var struct {
	Name  string
	Value string
}

Var represent a value object for an Env Variable

func VarFromSSMParameter

func VarFromSSMParameter(p *ssm.Parameter) *Var

VarFromSSMParameter create a new env var object from an SSM Paramater Struct

func (*Var) Export

func (v *Var) Export(f Formatter) string

Export return a string representation of an env var according to the given formatter spec

func (*Var) String

func (v *Var) String() string

String return the string representation of an evn var

Jump to

Keyboard shortcuts

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