Categorygithub.com/compose-spec/godotenv
modulepackage
1.1.1
Repository: https://github.com/compose-spec/godotenv.git
Documentation: pkg.go.dev

# README

GoDotEnv

A Go (golang) port of the Ruby dotenv project (which loads env vars from a .env file)

From the original Library:

Storing configuration in the environment is one of the tenets of a twelve-factor app. Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.

But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. Dotenv load variables from a .env file into ENV when the environment is bootstrapped.

This is a fork of joho/godotenv focussing on .env file support by the compose specification

To run linter and tests, please install Earthly and run:

earthly +all

# Functions

Exec loads env vars from the specified filenames (empty map falls back to default) then executes the cmd specified.
Load will read your env file(s) and load them into ENV for this process.
Marshal outputs the given environment as a dotenv-formatted environment file.
Overload will read your env file(s) and load them into ENV for this process.
Parse reads an env file from io.Reader, returning a map of keys and values.
ParseWithLookup reads an env file from io.Reader, returning a map of keys and values.
Read all env (with same file loading semantics as Load) but return values as a map rather than automatically writing values into env.
ReadWithLookup gets all env vars from the files and/or lookup function and return values as a map rather than automatically writing values into env.
Unmarshal reads an env file from a string, returning a map of keys and values.
UnmarshalBytes parses env file from byte slice of chars, returning a map of keys and values.
UnmarshalBytesWithLookup parses env file from byte slice of chars, returning a map of keys and values.
Write serializes the given environment and writes it to a file.

# Type aliases

LookupFn represents a lookup function to resolve variables from.