combined

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server *server.Config

	AWS         aws.Config
	SQS         awsps.SQSConfig
	SNS         awsps.SNSConfig
	S3          aws.S3
	DynamoDB    aws.DynamoDB
	ElastiCache aws.ElastiCache

	Kafka *kafka.Config

	Oracle oracle.Config

	PostgreSQL *postgresql.Config

	MySQL      *mysql.Config
	MySQLSlave *mysql.Config

	MongoDB *mongodb.Config

	Cookie cookie.Config

	// GraphiteHost is DEPRECATED. Please use the
	// Metrics config with "Type":"graphite" and this
	// value in the "Addr" field.
	GraphiteHost *string `envconfig:"GRAPHITE_HOST"`

	Metrics metrics.Config

	LogLevel *string `envconfig:"APP_LOG_LEVEL"`
	Log      *string `envconfig:"APP_LOG"`
}

Config is a generic struct to hold information for applications that need to connect to databases, handle cookies, log events or emit metrics. If you have a use case that does not fit this struct, you can make a struct containing just the types that suit your needs and use some of the helper functions in this package to load it from the environment.

func LoadConfigFromEnv

func LoadConfigFromEnv() *Config

LoadConfigFromEnv will attempt to inspect the environment of any valid config options and will return a populated Config struct with what it found. If you need a unique config object and want to use envconfig, you will need to run the LoadXXFromEnv for each child struct in your config struct. For an example on how to do this, check out the guts of this function.

func NewConfig

func NewConfig(fileName string) *Config

NewConfig will attempt to unmarshal the contents of the given JSON string source into a Config struct. The value of fileName can be either the path to a JSON file or a path to a JSON string found in Consul's Key Value storage (using the format consul:path/to/JSON/string). If the value of fileName is empty, a blank Config will be returned.

Jump to

Keyboard shortcuts

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