mirror-nourybot/pkg/config/config.go

31 lines
473 B
Go
Raw Normal View History

2021-10-13 21:30:31 +02:00
package config
import (
"os"
"github.com/joho/godotenv"
log "github.com/sirupsen/logrus"
)
type Config struct {
2021-10-14 00:45:32 +02:00
Username string
Oauth string
BotUserId string
2021-10-13 21:30:31 +02:00
}
func LoadConfig() *Config {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env")
}
cfg := &Config{
2021-10-14 00:45:32 +02:00
Username: os.Getenv("TWITCH_USER"),
Oauth: os.Getenv("TWITCH_PASS"),
BotUserId: os.Getenv("BOT_USER_ID"),
2021-10-13 21:30:31 +02:00
}
log.Info("Config loaded succesfully")
return cfg
}