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.
 
 
 
 

41 lines
746 B

package config
import (
"log"
"github.com/kelseyhightower/envconfig"
)
// type smtpConfig struct {
// Port int `envconfig:"SMTP_PORT"`
// Host string `envconfig:"SMTP_HOST"`
// Sender string `envconfig:"SMTP_SENDER"`
// Password string `envconfig:"SMTP_PASSWORD"`
// }
type telegramConfig struct {
ChatID int64 `envconfig:"CHAT_ID"`
ChatToken string `envconfig:"CHAT_TOKEN"`
}
type kafkaConfig struct {
Port int `envconfig:"KAFKA_PORT"`
Host string `envconfig:"KAFKA_HOST"`
}
// ...
type Config struct {
// Smtp smtpConfig
Kafka kafkaConfig
Telegram telegramConfig
}
func NewConfig() *Config {
c := Config{}
err := envconfig.Process("", &c)
if err != nil {
log.Fatal(err.Error())
}
return &c
}