27 lines
366 B

package config
import (
"log"
"github.com/kelseyhightower/envconfig"
)
type kafkaConfig struct {
Host string `envconfig:"KAFKA_HOST"`
Port int `envconfig:"KAFKA_PORT"`
}
// ...
type Config struct {
Kafka kafkaConfig
}
func NewConfig() *Config {
c := Config{}
err := envconfig.Process("", &c)
if err != nil {
log.Fatal(err.Error())
}
return &c
}