config

package
v0.0.0-...-99ab7b6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(defaults map[string]string, flagSet *flag.FlagSet) (map[string]string, error)

Build is the main utility from this package. It expects the following:

  • a defaults map with all the needed key-value pairs, the keys being in snake_case, with the only required key being config, pointing at the default path of the config file **relative** to $XDG_CONFIG_DIR (on linux, ~/.config)
  • a flagSet, defined with the flags in kebab-case (the default values here will be ignored) and the -config flag must exist

For free, it reads from the environment the values of the defaults map keys, transformed in SCREAMING_SNAKE_CASE. The rules of precedence, from less to more important, are: defaults, config file, env, flags.

Types

This section is empty.

Jump to

Keyboard shortcuts

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