envigo

package module
v0.0.0-...-b871d74 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2013 License: MIT Imports: 5 Imported by: 1

README

envigo

Override your configuration with environment variables.

GoDoc

Example

HTTP_PORT=8080 DEBUG=true go run examples/example.go

Documentation

Overview

Package envigo overrides your configuration with environment variables.

https://github.com/koofr/envigo

Copyright (c) 2013 Koofr d.o.o.

Written by Luka Zakrajšek <luka@koofr.net>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Envigo

func Envigo(m interface{}, prefix string, getenv EnvGetter) (err error)

Envigo overrides values in struct with values found by EnvGetter. Argument m must be pointer to structure. Argument prefix is prepended to key name for lookup. Argument getenv looks up value for key.

Mapping example:

config.Http.Port -> HTTP_PORT
config.Logging.Level -> LOGGING_LEVEL
config.Debug -> DEBUG

Types

type EnvGetter

type EnvGetter func(key string) (value string, ok bool)

EnvGetter is a function that returns value and true (if key is found) for key. Key is uppercased and build from field path.

func EnvironGetter

func EnvironGetter() EnvGetter

EnvironGetter is default getter for os.Environ

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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