🔧 Implement the TelegramConfig

This commit is contained in:
Alphyron 2020-04-11 23:01:14 +02:00
parent 91843e34e4
commit 6001cdba88
2 changed files with 21 additions and 0 deletions

14
config/telegram.go Normal file
View File

@ -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
}

View File

@ -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)
}
}