configutil

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package configutil contains methods for loading and reading from configuration files, and for reading 'dotenv' files.

Index

Constants

View Source
const (
	EnvProduction  = "production"
	EnvDevelopment = "development"
)

Well-known values for 'GOENV'.

View Source
const GoEnvKey = "GOENV"

GoEnvKey is the key for the environmant variable that describes the current environment (i.e. "production", "development").

Variables

This section is empty.

Functions

func GoEnv added in v0.6.2

func GoEnv() string

GoEnv reteurns the current environment value for 'GOENV'.

func LoadEnv

func LoadEnv(filenames ...string) error

LoadEnv attempts to loads environment variables from 'dotenv' files, as specified by filenames. If no filenames are given, it will attempt to read '.env' and '.env.local' in the current directory.

It will attempt to load environment variables from all the files in filenames, and will skip missing files.

func LookupGoEnv added in v0.4.1

func LookupGoEnv() (string, bool)

LookupGoEnv is like GetEnv, except it additionally returns true if 'GOENV' was set, and false otherwise.

func NewViper added in v0.5.0

func NewViper(name, namespace string) *viper.Viper

NewViper creates a new Viper that reads from a config file with the provided name, set in a namespace.

func UnmarshalViper added in v0.5.0

func UnmarshalViper(
	v *viper.Viper,
	ptr zero.Interface,
	opts ...viper.DecoderConfigOption,
) error

UnmarshalViper unmarshals the configuration data in viper.Viper into the value pointed to by ptr.

Types

This section is empty.

Jump to

Keyboard shortcuts

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