conf for gin engine

This commit is contained in:
nquidox 2026-03-05 16:20:47 +03:00
parent 5f72059bb6
commit fb7f88ff7e
3 changed files with 44 additions and 4 deletions

View file

@ -8,9 +8,10 @@ import (
)
type Config struct {
AppConf AppConfig
TgConf TelegramConfig
DsConf DiscordConfig
AppConf AppConfig
TgConf TelegramConfig
DsConf DiscordConfig
HttpConf HttpConfig
}
type AppConfig struct {
@ -28,10 +29,17 @@ type DiscordConfig struct {
ChannelID snowflake.ID
}
type HttpConfig struct {
Host string
Port string
GinMode string
}
// prod config
func NewConfig() *Config {
return &Config{
AppConfig{
LogLvl: getEnv("APP_LOG_LEVEL", "info"),
LogLvl: getEnv("APP_LOG_LEVEL", "debug"),
},
TelegramConfig{
Token: getEnv("TELEGRAM_TOKEN", ""),
@ -42,6 +50,12 @@ func NewConfig() *Config {
GuildID: convertID(getEnv("GUILD_ID", "")),
ChannelID: convertID(getEnv("CHANNEL_ID", "")),
},
HttpConfig{
Host: getEnv("HTTP_HOST", "0.0.0.0"),
Port: getEnv("HTTP_PORT", "8080"),
GinMode: getEnv("GIN_MODE", "debug"),
},
}
}