Beispiel #1
0
// 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 LoadConfigFromEnv() *Config {
	var app Config
	config.LoadEnvConfig(&app)
	app.AWS = aws.LoadConfigFromEnv()
	app.SNS = awsps.LoadSNSConfigFromEnv()
	app.SQS = awsps.LoadSQSConfigFromEnv()
	app.S3 = aws.LoadS3FromEnv()
	app.DynamoDB = aws.LoadDynamoDBFromEnv()
	app.ElastiCache = aws.LoadElastiCacheFromEnv()
	app.MongoDB = mongodb.LoadConfigFromEnv()
	app.Kafka = kafka.LoadConfigFromEnv()
	app.MySQL = mysql.LoadConfigFromEnv()
	app.Oracle = oracle.LoadConfigFromEnv()
	app.Cookie = cookie.LoadConfigFromEnv()
	app.Server = server.LoadConfigFromEnv()
	app.Metrics = metrics.LoadConfigFromEnv()
	return &app
}
Beispiel #2
0
// LoadConfigFromEnv will attempt to load a Server object
// from environment variables. If not populated, nil
// is returned.
func LoadConfigFromEnv() *Config {
	var server Config
	config.LoadEnvConfig(&server)
	server.Metrics = metrics.LoadConfigFromEnv()
	return &server
}