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
760 B

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