66 lines
1.2 KiB
Go
66 lines
1.2 KiB
Go
package config
|
|
|
|
import "time"
|
|
|
|
type Config struct {
|
|
App App
|
|
Http Http
|
|
TasksSource TasksSource
|
|
DBase DBase
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
type DBase struct {
|
|
Host string
|
|
Port string
|
|
Username string
|
|
Password string
|
|
DBName string
|
|
}
|
|
|
|
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),
|
|
},
|
|
|
|
DBase: DBase{
|
|
Host: getEnv("DB_HOST", "10.0.0.4"),
|
|
Port: getEnv("DB_PORT", "54326"),
|
|
Username: getEnv("DB_USERNAME", "merch_app_user"),
|
|
Password: getEnv("DB_PASSWORD", "7kek8wait9"),
|
|
DBName: getEnv("DB_NAME", "merch_dev"),
|
|
},
|
|
}
|
|
}
|