binit - execs a program with environment variables loaded from INI files
binit is an env
-like tool to exec programs with environment variables loaded
from INI files (similar to chpst -e dir
as well in that regard).
INI files are loaded by passing a path to a file with the -f=FILE option.
- -c={c|u|d}
-
Case transformations to apply to keys.
-
c - preserve variable names' case.
-
u - uppercase all variable names.
-
d - lowercase all variable names.
-
- -e=NAME=VALUE
-
Set the environment variable NAME to VALUE. May be set multiple times to set multiple variables.
- -f=FILE
-
INI files to load into the environment. Pass '-' (hyphen) for FILE to read from standard input. May be set multiple times to load multiple files.
- -L
-
Config file values are appended to environment config instead of prepended. May be combined with -n and -N to double-negate precedence.
- -i
-
Whether to omit current environment variables from the exec.
- -m=NAME
-
Import a specific variable from the environment. May include * for wildcard matches. May be set multiple times to import multiple variables.
Implies -i.
- -n
-
Preserve only the last-set value for an environment value. If two values are encountered, instead of merging them using the -s separator, it will discard all but the last value seen.
- -N
-
Preserve only the first-set value for an environment value when -n is set.
Implies -n.
- -S=SEPARATOR
-
The string separator inserted between group names and keys in INI files. Defaults to "." (dot or period).
- -s=SEPARATOR
-
The string separator inserted between multi-value keys. May include Go escape characters if quoted according to Go. Defaults to " " (space).
binit -e thing.var=value -f config.ini -i
-
Without a CMD, binit will print a list of all environment variables it would pass to a CMD.
binit -f config.ini -N some-service
-
Run
some-service
after loading env vars from config.ini. With -N, the env vars in the environment take precedence over those of the config file.