feat: Automatic comment translation using DeepL
Some checks failed
Build and Push to Docker Hub on push to any branch / docker (push) Has been cancelled

This commit is contained in:
Noah 2025-10-13 06:08:26 +02:00
parent c6c7480493
commit 1e94b1fc1e
No known key found for this signature in database
GPG key ID: D2A7E2C8F77E0430
10 changed files with 250 additions and 20 deletions

View file

@ -2,28 +2,31 @@ package config
import (
"context"
"strings"
"github.com/joho/godotenv"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/joho/godotenv"
envconfig "github.com/sethvargo/go-envconfig"
)
var BotConfig config
func LoadConfig() {
if err := godotenv.Load(); err != nil {
if err := godotenv.Load(); err != nil {
log.Info().Err(err).Msg("Failed to load .env file, using the system environment")
} else {
log.Info().Err(err).Msg(".env file loaded successfully")
}
if err := envconfig.Process(context.Background(), &BotConfig); err != nil {
log.Panic().Err(err).Msg("Failed to parse config from env variables")
log.Fatal().Err(err).Msg("Failed to parse config from env variables")
}
zerolog.SetGlobalLevel(zerolog.Level(BotConfig.LogLevel))
BotConfig.TranslateLanguage = strings.ToUpper(BotConfig.TranslateLanguage)
log.Info().Msg("Config loaded successfully")
log.Debug().Interface("config", BotConfig).Msg("")