gofig

package module
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2017 License: Apache-2.0 Imports: 19 Imported by: 724

README

Gofig Build Status Go Report Card Coverage Status GoDoc

Gofig simplifies external, runtime configuration of go programs.

Documentation

Overview

Package gofig simplifies external, runtime configuration of go programs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogGetAndSet determines whether or not gettting and seetting values
	// is logged.
	LogGetAndSet, _ = strconv.ParseBool(os.Getenv("GOFIG_LOG_GETSET"))

	// LogSecureKey determines whether or not secure key attempts are logged.
	LogSecureKey, _ = strconv.ParseBool(os.Getenv("GOFIG_LOG_SECUREKEY"))

	// LogFlattenEnvVars determines whether or not flattening environment
	// variables is logged.
	LogFlattenEnvVars, _ = strconv.ParseBool(os.Getenv("GOFIG_LOG_FLATTEN"))

	// LogRegKey determines whether or not key registrations are logged.
	LogRegKey, _ = strconv.ParseBool(os.Getenv("GOFIG_LOG_REGKEY"))

	// DisableEnvVarSubstitution determines whether or not Gofig will replace
	// environment variables with their actual values. This transformation is
	// applied only to the values returned by the GetString and GetStringSlice
	// functions. Environment variable substitution is not applied to config
	// keys for example.
	//
	// New Config instances inherit this value at the time of the instance
	// creation. However, this value has no effect on existing config instances.
	// Those instances have a function named DisableEnvVarSubstitution that is
	// able to disable/enable the feature for that instance.
	DisableEnvVarSubstitution, _ = strconv.ParseBool(
		os.Getenv("GOFIG_DISABLE_ENVVAR_SUBSTITUTION"))
)

Functions

func FromJSON

func FromJSON(from string) (types.Config, error)

FromJSON initializes a new Config instance from a JSON string

func New

func New() types.Config

New initializes a new instance of a types.Config struct

func NewConfig

func NewConfig(
	loadGlobalConfig, loadUserConfig bool,
	configName, configType string) types.Config

NewConfig initialies a new instance of a Config object with the specified options.

func NewRegistration

func NewRegistration(name string) types.ConfigRegistration

NewRegistration creates a new registration with the given name.

func Register

func Register(r types.ConfigRegistration)

Register registers a new configuration with the config package.

func SetGlobalConfigPath

func SetGlobalConfigPath(path string)

SetGlobalConfigPath sets the path of the directory from which the global configuration file is read.

func SetUserConfigPath

func SetUserConfigPath(path string)

SetUserConfigPath sets the path of the directory from which the user configuration file is read.

func ValidateYAML added in v0.1.3

func ValidateYAML(r io.Reader) (map[interface{}]interface{}, error)

ValidateYAML verifies the YAML in the stream is valid.

func ValidateYAMLString added in v0.1.3

func ValidateYAMLString(s string) (map[interface{}]interface{}, error)

ValidateYAMLString verifies the YAML string valid.

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