envflags

package
v0.0.0-...-721f978 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package envflags package houses the SetFlags and ConfigEmpty methods for conveniently specifiying config via a single struct. Using tags on the struct fields, both the cli flag option name and environment variable name can be specified it can be specified. Environment variable values will be defaults, with cli options taking preference if specified.

example struct:

type config struct {
    StructField string `flag:"struct_field" env:"APP_STRUCTFIELD"`
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigEmpty

func ConfigEmpty(s interface{}) bool

ConfigEmpty takes a config struct and determines if any of its field's values are their zero value, meaning that their associated config flag and environment variable were not specified.

func SetFlags

func SetFlags(s interface{}) bool

SetFlags takes a config struct and set its fields as options via the flags library, with the default value being the field's environment variable.

Types

This section is empty.

Jump to

Keyboard shortcuts

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