Documentation

Overview

    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)

    Index

    Constants

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

      DefaultConfigLocation is the default filepath for JSON config files.

      Variables

      View Source
      var EnvAppName = ""

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

        Functions

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

              Types

              This section is empty.

              Directories

              Path Synopsis