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_LOG_LVL=info
|
||||
APP_CHECK_PERIOD_SECONDS=21600
|
||||
APP_PROCESSOR_CHANNEL_SIZE=100
|
||||
|
||||
#[HTTP]
|
||||
HTTP_HOST=0.0.0.0
|
||||
|
|
@ -13,3 +14,8 @@ TASK_SOURCE_PORT=
|
|||
TASK_SOURCE_TIMEOUT_SECONDS=
|
||||
|
||||
#[RABBIT]
|
||||
RABBIT_HOST=
|
||||
RABBIT_PORT=
|
||||
RABBIT_USER=
|
||||
RABBIT_PASS=
|
||||
RABBIT_VHOST=
|
||||
|
|
@ -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