Documentation ¶
Index ¶
- func Exec(filenames []string, cmd string, cmdArgs []string, overload bool) error
- func Load(filenames ...string) error
- func Marshal(envMap map[string]string) (string, error)
- func Overload(filenames ...string) error
- func Parse(r io.Reader) (map[string]string, error)
- func Read(filenames ...string) (map[string]string, error)
- func Unmarshal(str string) (envMap map[string]string, err error)
- func UnmarshalBytes(src []byte) (map[string]string, error)
- func Write(envMap map[string]string, filename string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec loads environment variabless from the specified filenames (empty map falls back to default .env.vault file) then executes the specified command.
This simply hooks os.Stdin/err/out up to the command and calls Run().
If you want more fine grained control over your command, it's recommended that you use `Load()`, `Overload()` or `Read()` and the `os/exec` package yourself.
func Load ¶
Load will read your encrypted env file(s) and load them into the environment for this process.
Call this function as close as possible to the start of your program (ideally in main).
If you call Load without any args it will default to loading .env.vault in the current path.
You can otherwise tell it which files to load (there can be more than one) like:
godotenvvault.Load("fileone", "filetwo")
It's important to note that it WILL NOT OVERRIDE an environment variable that already exists - consider the .env.vault file to set development variables or sensible defaults.
func Marshal ¶
Marshal outputs the given environment as a dotenv-formatted environment file. Each line is in the format: KEY="VALUE" where VALUE is backslash-escaped.
func Overload ¶
Overload will read your encrypted env file(s) and load them into the environment for this process.
Call this function as close as possible to the start of your program (ideally in main).
If you call Overload without any args it will default to loading .env.vault in the current path.
You can otherwise tell it which files to load (there can be more than one) like:
godotenvvault.Overload("fileone", "filetwo")
It's important to note this WILL OVERRIDE an environment variable that already exists - consider the .env.vault file to forcefully set all environment variables.
func Parse ¶
Parse reads an encrypted .env.vault files from an io.Reader, returning a map of keys and values.
func Read ¶
Read all encrypted environments (with the same file loading semantics as Load) but return values as a map rather than automatically writing values into the environment.
func Unmarshal ¶
Unmarshal reads an environment file from a string, returning a map of keys and values.
func UnmarshalBytes ¶
UnmarshalBytes parses an environment file from a byte slice of chars, returning a map of keys and values.
Types ¶
This section is empty.