new fields

This commit is contained in:
nquidox 2026-02-18 19:58:09 +03:00
parent ca36d84a03
commit f6e99b2b65
3 changed files with 41 additions and 15 deletions

View file

@ -1,5 +1,7 @@
package config
import "time"
type Config struct {
App App
Http Http
@ -7,8 +9,9 @@ type Config struct {
}
type App struct {
Mode string
LogLvl string
Mode string
LogLvl string
CheckPeriod time.Duration
}
type Http struct {
@ -17,25 +20,28 @@ type Http struct {
}
type TasksSource struct {
Host string
Port string
Host string
Port string
Timeout time.Duration
}
func NewConfig() Config {
return Config{
App: App{
Mode: getEnv("APP_MODE", "dev"),
LogLvl: getEnv("APP_LOG_LVL", "debug"),
Mode: getEnv("APP_MODE", "dev"),
LogLvl: getEnv("APP_LOG_LVL", "debug"),
CheckPeriod: getEnvSeconds("APP_CHECK_PERIOD_SECONDS", 20),
},
Http: Http{
Host: getEnv("HOST", "0.0.0.0"),
Port: getEnv("PORT", "41082"),
Host: getEnv("HTTP_HOST", "0.0.0.0"),
Port: getEnv("HTTP_PORT", "41082"),
},
TasksSource: TasksSource{
Host: getEnv("TASK_API_HOST", ""),
Port: getEnv("TASK_API_PORT", ""),
Host: getEnv("TASK_API_HOST", ""),
Port: getEnv("TASK_API_PORT", ""),
Timeout: getEnvSeconds("TASK_SOURCE_TIMEOUT_SECONDS", 60),
},
}
}