Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Stage map[string]string `toml:"stage"` // Stage holds the path to the central environment file.
Group map[string]Group `toml:"group"` // Group holds the configuration for each group of environment variables.
// contains filtered or unexported fields
}
Config holds settings such as where the central env is located, how it is divided, and to which groups it is delivered. It is read from a configuration file in TOML format.
func (*Config) List ¶ added in v0.0.6
List returns a slice of Entry for all env entries of all groups for the given stage. If stage is empty, returns an error.
func (*Config) Run ¶
Run reads the central environment and divides and distributes it to each group based on the configuration file. If necessary, it also checks if the environment variable values are empty.
type Entry ¶ added in v0.0.6
type Entry struct {
Group string // Group is the group name of the environment variable
Prefix string // Prefix is the prefix for the environment variable names of its group
Type string // Type indicates whether the env entry is indirect
Name string // Name is the key of the env entry, used for identification
Value string // Value is the value of the env entry
}
Entry represents an environment variable entry.
type Group ¶
type Group struct {
Prefix string `toml:"prefix"` // Prefix for the environment variable names
Dir string `toml:"dir"` // Directory to which the environment variables are delivered
Replaceable []string `toml:"replace"` // List of prefixes to be delivered by replacing group prefixes
Plain []string `toml:"plain"` // List of environment variables delivered without prefixes
DirenvSupport []string `toml:"direnv"` // Groups for which .envrc is generated
IsCheck bool `toml:"check"` // Whether to check for empty values
}
Group groups environment variables using several parameters.
type Option ¶
type Option func(*Config)
Option is an option given when loading the configuration file.
func WithSize ¶
WithSize sets the size to be allocated when reading the central env into the map. If not used, this value remains 32.
func WithWriter ¶
WithWriter sets the specified writer to the Config. If not used, the output remains standard output.