config

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 8 Imported by: 0

README

config Eloquent configuration for Golang apps.

Features:

  • Substitutes $VARIABLE and ${VARIABLE} with variables found in a shell environment.
  • Syntaxes for setting up default values and specifying mandatory variables:
    • ${VARIABLE:-default} evaluates to default if VARIABLE is unset or empty in the environment.
    • ${VARIABLE-default} evaluates to default only if VARIABLE is unset in the environment.
    • ${VARIABLE:?err} exits with an error message containing err if VARIABLE is unset or empty in the environment.
    • ${VARIABLE?err} exits with an error message containing err if VARIABLE is unset in the environment.
  • By default loads .env, but with optional agruments to config.LoadFile can load other files.

Examples:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(in io.Reader, rawVal interface{}, configType string) error

func LoadFile added in v0.1.1

func LoadFile(rawVal interface{}, filename string, envPath ...string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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