extended
This commit is contained in:
parent
689cfe4101
commit
1503516a41
2 changed files with 27 additions and 2 deletions
|
|
@ -6,12 +6,14 @@ type Config struct {
|
|||
App App
|
||||
Http Http
|
||||
TasksSource TasksSource
|
||||
Rabbit Rabbit
|
||||
}
|
||||
|
||||
type App struct {
|
||||
Mode string
|
||||
LogLvl string
|
||||
CheckPeriod time.Duration
|
||||
ProcChanLen uint
|
||||
}
|
||||
|
||||
type Http struct {
|
||||
|
|
@ -25,12 +27,21 @@ type TasksSource struct {
|
|||
Timeout time.Duration
|
||||
}
|
||||
|
||||
type Rabbit struct {
|
||||
Host string
|
||||
Port string
|
||||
User string
|
||||
Pass string
|
||||
Vhost string
|
||||
}
|
||||
|
||||
func NewConfig() Config {
|
||||
return Config{
|
||||
App: App{
|
||||
Mode: getEnv("APP_MODE", "dev"),
|
||||
LogLvl: getEnv("APP_LOG_LVL", "debug"),
|
||||
CheckPeriod: getEnvSeconds("APP_CHECK_PERIOD_SECONDS", 20),
|
||||
ProcChanLen: getEnvUint("APP_PROCESSOR_CHANNEL_SIZE", 100),
|
||||
},
|
||||
|
||||
Http: Http{
|
||||
|
|
@ -39,9 +50,17 @@ func NewConfig() Config {
|
|||
},
|
||||
|
||||
TasksSource: TasksSource{
|
||||
Host: getEnv("TASK_API_HOST", ""),
|
||||
Port: getEnv("TASK_API_PORT", ""),
|
||||
Host: getEnv("TASK_API_HOST", "127.0.0.1"),
|
||||
Port: getEnv("TASK_API_PORT", "61000"),
|
||||
Timeout: getEnvSeconds("TASK_SOURCE_TIMEOUT_SECONDS", 60),
|
||||
},
|
||||
|
||||
Rabbit: Rabbit{
|
||||
Host: getEnv("RABBIT_HOST", "10.0.0.4"),
|
||||
Port: getEnv("RABBIT_PORT", "5672"),
|
||||
User: getEnv("RABBIT_USER", "taskProcessorDev"),
|
||||
Pass: getEnv("RABBIT_PASS", "pass1234"),
|
||||
Vhost: getEnv("RABBIT_VHOST", "taskProcessorDevHost"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue