task-processor/config/config.go

48 lines
831 B
Go
Raw Normal View History

2026-02-18 15:53:29 +03:00
package config
2026-02-18 19:58:09 +03:00
import "time"
2026-02-18 15:53:29 +03:00
type Config struct {
App App
Http Http
TasksSource TasksSource
}
type App struct {
2026-02-18 19:58:09 +03:00
Mode string
LogLvl string
CheckPeriod time.Duration
2026-02-18 15:53:29 +03:00
}
type Http struct {
Host string
Port string
}
type TasksSource struct {
2026-02-18 19:58:09 +03:00
Host string
Port string
Timeout time.Duration
2026-02-18 15:53:29 +03:00
}
func NewConfig() Config {
return Config{
App: App{
2026-02-18 19:58:09 +03:00
Mode: getEnv("APP_MODE", "dev"),
LogLvl: getEnv("APP_LOG_LVL", "debug"),
CheckPeriod: getEnvSeconds("APP_CHECK_PERIOD_SECONDS", 20),
2026-02-18 15:53:29 +03:00
},
Http: Http{
2026-02-18 19:58:09 +03:00
Host: getEnv("HTTP_HOST", "0.0.0.0"),
Port: getEnv("HTTP_PORT", "41082"),
2026-02-18 15:53:29 +03:00
},
TasksSource: TasksSource{
2026-02-18 19:58:09 +03:00
Host: getEnv("TASK_API_HOST", ""),
Port: getEnv("TASK_API_PORT", ""),
Timeout: getEnvSeconds("TASK_SOURCE_TIMEOUT_SECONDS", 60),
2026-02-18 15:53:29 +03:00
},
}
}