Help us shape the future of Go! Take the 2026 Go Developer Survey

multiconfig

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyAttributeError

func EmptyAttributeError(attr string) error

EmptyAttributeError is for when a required attribute is empty

Types

type Configs

type Configs map[string]*marshal.Config

Configs contains map of "path" --> BodyEnv structs

type MultiConfig

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

MultiConfig is simply the struct method-wrapper for the "multiconfig" package

func New

func New() *MultiConfig

New creates a new MultiConfigs struct

func (*MultiConfig) AddFromString

func (s *MultiConfig) AddFromString(path string, body string) error

AddFromString allows to add new *.env string to the list of MultiConfigs

- Need to provide the body-content as a string.

- Need to provide a "path" to where the .env was read from, to allow for combination based on lexical-order of this path.

- This gets parsed immediately, not deferred until combined.

TODO: Is "path" the wrong name for this?

func (*MultiConfig) Combine

func (s *MultiConfig) Combine() (map[string]string, error)

Combine Combine all the .env's provided into a single .env map

Returns a new .env map (gotenv.Env) with the combined .env's. The .env's are combined by lexical-ordering of the "path" field;

i.e. an .env with a "path" of "z..." will be added after those with a "path" of "a..."

TODO: Need to make sure file's named ".env" (only) are parsed last, somehow...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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