merch-api/config/config.go
2026-02-23 19:33:36 +03:00

49 lines
864 B
Go

package config
import "time"
type Config struct {
App App
Http Http
TasksSource TasksSource
}
type App struct {
LogLvl string
Mode string
}
type Http struct {
Host string
Port string
Prefix 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"),
Mode: getEnv("APP_MODE", "dev"),
},
Http: Http{
Host: getEnv("HTTP_HOST", "0.0.0.0"),
Port: getEnv("HTTP_PORT", "41083"),
Prefix: getEnv("HTTP_PREFIX", "/api/v2"),
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),
},
}
}