config

package
v0.0.0-...-ec7f410 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides helper functions for reading a JSON formatted configuration file into an arbitrary struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(filename string, v interface{})

Load reads the JSON-encoded file and marshalls the contents into the value pointed at by v. Panics if unsuccessful

func Parse

func Parse(jsondata []byte, v interface{})

Parse parses the JSON-encoded data and stores the result into the value pointed at by c. Panics if unsuccessful

Types

type MarshalledEnvironmentVar

type MarshalledEnvironmentVar struct {
	EnvKey          string
	EnvVal          string
	StructFieldName string
	Error           error
}

func LoadFromEnv

func LoadFromEnv(v interface{}, prefix string) (result []MarshalledEnvironmentVar)

LoadFromEnv iterates through a struct's fields and tries to find matching environment variables. Returns a map of environment key and values that were successfully set into the struct

Jump to

Keyboard shortcuts

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