You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
933 B

package config
import (
"log"
"github.com/kelseyhightower/envconfig"
)
type appConfig struct {
Port int `envconfig:"APP_PORT"`
}
type kafkaConfig struct {
Port int `envconfig:"KAFKA_PORT"`
Host string `envconfig:"KAFKA_HOST"`
}
type arangoConfig struct {
Port int `envconfig:"ARANGO_PORT"`
Host string `envconfig:"ARANGO_HOST"`
User string `envconfig:"ARANGO_USER"`
Password string `envconfig:"ARANGO_PASSWORD"`
}
type sentryConfig struct {
DSN string `envconfig:"SENTRY_DSN"`
}
// ...
type Config struct {
App appConfig
Kafka kafkaConfig
Sentry sentryConfig
Arango arangoConfig
MinutesReregistration int `envconfig:"MINUTES_REREGISTRATION"` // number of minutes until the next registration
}
func NewConfig() *Config {
c := Config{}
err := envconfig.Process("", &c)
if err != nil {
log.Fatal(err.Error())
}
return &c
}