extended
This commit is contained in:
parent
689cfe4101
commit
1503516a41
2 changed files with 27 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
APP_MODE=dev
|
APP_MODE=dev
|
||||||
APP_LOG_LVL=info
|
APP_LOG_LVL=info
|
||||||
APP_CHECK_PERIOD_SECONDS=21600
|
APP_CHECK_PERIOD_SECONDS=21600
|
||||||
|
APP_PROCESSOR_CHANNEL_SIZE=100
|
||||||
|
|
||||||
#[HTTP]
|
#[HTTP]
|
||||||
HTTP_HOST=0.0.0.0
|
HTTP_HOST=0.0.0.0
|
||||||
|
|
@ -13,3 +14,8 @@ TASK_SOURCE_PORT=
|
||||||
TASK_SOURCE_TIMEOUT_SECONDS=
|
TASK_SOURCE_TIMEOUT_SECONDS=
|
||||||
|
|
||||||
#[RABBIT]
|
#[RABBIT]
|
||||||
|
RABBIT_HOST=
|
||||||
|
RABBIT_PORT=
|
||||||
|
RABBIT_USER=
|
||||||
|
RABBIT_PASS=
|
||||||
|
RABBIT_VHOST=
|
||||||
|
|
@ -6,12 +6,14 @@ type Config struct {
|
||||||
App App
|
App App
|
||||||
Http Http
|
Http Http
|
||||||
TasksSource TasksSource
|
TasksSource TasksSource
|
||||||
|
Rabbit Rabbit
|
||||||
}
|
}
|
||||||
|
|
||||||
type App struct {
|
type App struct {
|
||||||
Mode string
|
Mode string
|
||||||
LogLvl string
|
LogLvl string
|
||||||
CheckPeriod time.Duration
|
CheckPeriod time.Duration
|
||||||
|
ProcChanLen uint
|
||||||
}
|
}
|
||||||
|
|
||||||
type Http struct {
|
type Http struct {
|
||||||
|
|
@ -25,12 +27,21 @@ type TasksSource struct {
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Rabbit struct {
|
||||||
|
Host string
|
||||||
|
Port string
|
||||||
|
User string
|
||||||
|
Pass string
|
||||||
|
Vhost string
|
||||||
|
}
|
||||||
|
|
||||||
func NewConfig() Config {
|
func NewConfig() Config {
|
||||||
return Config{
|
return Config{
|
||||||
App: App{
|
App: App{
|
||||||
Mode: getEnv("APP_MODE", "dev"),
|
Mode: getEnv("APP_MODE", "dev"),
|
||||||
LogLvl: getEnv("APP_LOG_LVL", "debug"),
|
LogLvl: getEnv("APP_LOG_LVL", "debug"),
|
||||||
CheckPeriod: getEnvSeconds("APP_CHECK_PERIOD_SECONDS", 20),
|
CheckPeriod: getEnvSeconds("APP_CHECK_PERIOD_SECONDS", 20),
|
||||||
|
ProcChanLen: getEnvUint("APP_PROCESSOR_CHANNEL_SIZE", 100),
|
||||||
},
|
},
|
||||||
|
|
||||||
Http: Http{
|
Http: Http{
|
||||||
|
|
@ -39,9 +50,17 @@ func NewConfig() Config {
|
||||||
},
|
},
|
||||||
|
|
||||||
TasksSource: TasksSource{
|
TasksSource: TasksSource{
|
||||||
Host: getEnv("TASK_API_HOST", ""),
|
Host: getEnv("TASK_API_HOST", "127.0.0.1"),
|
||||||
Port: getEnv("TASK_API_PORT", ""),
|
Port: getEnv("TASK_API_PORT", "61000"),
|
||||||
Timeout: getEnvSeconds("TASK_SOURCE_TIMEOUT_SECONDS", 60),
|
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