v1.3.6 Latest Latest

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 4 Imported by: 353



Package config contains a handful of useful functions to load to configuration structs from JSON files or environment variables.

The subpackages contain structs meant for managing common configuration options and credentials. There are currently configs for:

* Go Kit Metrics * MySQL * PostgreSQL * AWS (S3, DynamoDB, ElastiCache)



View Source
const DefaultConfigLocation = "/opt/nyt/etc/conf.json"

DefaultConfigLocation is the default filepath for JSON config files.


View Source
var EnvAppName = ""

EnvAppName is used as a prefix for environment variable names when using the LoadXFromEnv funcs. It defaults to empty.


func LoadJSONFile

func LoadJSONFile(fileName string, cfg interface{})

LoadJSONFile is a helper function to read a config file into whatever config struct you need. For example, your custom config could be composed of one or more of the given Config, AWS, MySQL, Oracle or MongoDB structs.

func SetFlagOverrides

func SetFlagOverrides(log *string, config *string)

SetFlagOverrides will add and check a `log` and `config` CLI flag to the current process, call flag.Parse() and will overwrite the passed in string pointer if the flag exists.

func SetLogOverride

func SetLogOverride(log *string)

SetLogOverride will check `*LogCLI` for any values and override the given string pointer if LogCLI is set. If LogCLI is set to "dev", the given log var will be set to "".


This section is empty.


Path Synopsis

Jump to

Keyboard shortcuts

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