diff --git a/config/telegram.go b/config/telegram.go new file mode 100644 index 0000000..adc96f8 --- /dev/null +++ b/config/telegram.go @@ -0,0 +1,14 @@ +package config + +import "github.com/caarlos0/env" + +type TelegramConfig struct { + TelegramKey string `env:"TELEGRAM_KEY,required"` +} + +func (tc *TelegramConfig) LoadConfig() error { + if err := env.Parse(tc); err != nil { + return err + } + return nil +} diff --git a/main.go b/main.go index 43943ac..2ef8d2b 100644 --- a/main.go +++ b/main.go @@ -12,4 +12,11 @@ func main() { log.Println("Problem while loading database environment variables") log.Fatal(err) } + + err = config.TelegramConfig{}.LoadConfig() + + if err != nil { + log.Println("Problem while loading telegram environment variables") + log.Fatal(err) + } }