gizmo: Index | Files | Directories

package config

import ""

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)


Package Files

config.go doc.go flags.go


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

DefaultConfigLocation is the default filepath for JSON config files.


var EnvAppName = ""

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

func LoadJSONFile Uses

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 Uses

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 Uses

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 "".



Package config imports 4 packages (graph) and is imported by 213 packages. Updated 2020-01-11. Refresh now. Tools for package owners.