Files
velox-bot/internal/config/config.go
FernandoJVideiraandClaude Sonnet 5.5 1ee6280d91 Beta server and role come from the dashboard
The owner sets them on the admin page; the bot polls the shared beta_settings
row (30s) and moves the beta commands if the server changes. BETA_* env vars
are gone.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-23 00:55:09 +01:00

59 lines
1.2 KiB
Go

package config
import (
"fmt"
"os"
"github.com/joho/godotenv"
)
type Config struct {
BotToken string
AppID string
GuildID string
DBHost string
LavalinkHost string
LavalinkPass string
TwitchClientID string
}
func LoadConfig() (*Config, error) {
// Load .env if present (e.g. local dev). Ignore if missing (e.g. Docker injects env vars).
_ = godotenv.Load()
token := os.Getenv("BOT_TOKEN")
if token == "" {
return nil, fmt.Errorf("BOT_TOKEN is not set")
}
appID := os.Getenv("APP_ID")
if appID == "" {
return nil, fmt.Errorf("APP_ID is not set")
}
guildID := os.Getenv("GUILD_ID")
dbHost := os.Getenv("DB_HOST")
if dbHost == "" {
return nil, fmt.Errorf("DB_HOST is not set")
}
lavalinkHost := os.Getenv("LAVALINK_HOST")
lavalinkPass := os.Getenv("LAVALINK_PASSWORD")
twitchClientID := os.Getenv("TWITCH_CLIENT_ID")
if twitchClientID == "" {
return nil, fmt.Errorf("TWITCH_CLIENT_ID is not set")
}
return &Config{
BotToken: token,
AppID: appID,
GuildID: guildID,
DBHost: dbHost,
LavalinkHost: lavalinkHost,
LavalinkPass: lavalinkPass,
TwitchClientID: twitchClientID,
}, nil
}