This commit is contained in:
nquidox 2026-02-23 18:34:26 +03:00
parent 785a18147d
commit 0c526fd70c
4 changed files with 181 additions and 0 deletions

45
config/config.go Normal file
View file

@ -0,0 +1,45 @@
package config
import "time"
type Config struct {
App App
Http Http
TasksSource TasksSource
}
type App struct {
LogLvl string
}
type Http struct {
Host string
Port string
GinMode string
}
type TasksSource struct {
Host string
Port string
Timeout time.Duration
}
func NewConfig() Config {
return Config{
App: App{
LogLvl: getEnv("APP_LOG_LVL", "debug"),
},
Http: Http{
Host: getEnv("HTTP_HOST", "0.0.0.0"),
Port: getEnv("HTTP_PORT", "41082"),
GinMode: getEnv("GIN_MODE", "dev"),
},
TasksSource: TasksSource{
Host: getEnv("TASK_API_HOST", "127.0.0.1"),
Port: getEnv("TASK_API_PORT", "61000"),
Timeout: getEnvSeconds("TASK_SOURCE_TIMEOUT_SECONDS", 60),
},
}
}