diff --git a/config.env b/config.env index aef7254..42f4f76 100644 --- a/config.env +++ b/config.env @@ -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= \ No newline at end of file diff --git a/config/config.go b/config/config.go index 0161724..a4f88e4 100644 --- a/config/config.go +++ b/config/config.go @@ -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"), + }, } }