This commit is contained in:
Noah 2024-12-20 02:09:07 +01:00
parent 0c9b98cab4
commit 8fecdee6b8
No known key found for this signature in database
GPG key ID: D2A7E2C8F77E0430
16 changed files with 408 additions and 1 deletions

24
config/config.go Normal file
View file

@ -0,0 +1,24 @@
package config
import (
"context"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
envconfig "github.com/sethvargo/go-envconfig"
)
var BotConfig config
func LoadConfig() {
if err := envconfig.Process(context.Background(), &BotConfig); err != nil {
log.Panic().Err(err).Msg("error parsing config from env variables")
}
if !BotConfig.DebugMode {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}
log.Info().Msg("Loaded config")
log.Debug().Interface("config", BotConfig).Msg("")
}