log enabled dep
This commit is contained in:
parent
c5013c03ff
commit
b29e60b712
6 changed files with 39 additions and 21 deletions
|
|
@ -28,11 +28,12 @@ type TasksSource struct {
|
|||
}
|
||||
|
||||
type Rabbit struct {
|
||||
Host string
|
||||
Port uint16
|
||||
User string
|
||||
Pass string
|
||||
Vhost string
|
||||
Host string
|
||||
Port uint16
|
||||
User string
|
||||
Pass string
|
||||
Vhost string
|
||||
LoggingEnabled bool
|
||||
}
|
||||
|
||||
func NewConfig() Config {
|
||||
|
|
@ -50,17 +51,20 @@ func NewConfig() Config {
|
|||
},
|
||||
|
||||
TasksSource: TasksSource{
|
||||
Host: getEnv("TASK_SOURCE_HOST", "127.0.0.1"),
|
||||
Port: getEnv("TASK_SOURCE_PORT", "61000"),
|
||||
//Host: getEnv("TASK_SOURCE_HOST", "127.0.0.1"),
|
||||
//Port: getEnv("TASK_SOURCE_PORT", "61000"),
|
||||
Host: getEnv("TASK_SOURCE_HOST", "10.0.0.1"),
|
||||
Port: getEnv("TASK_SOURCE_PORT", "9099"),
|
||||
Timeout: getEnvSeconds("TASK_SOURCE_TIMEOUT_SECONDS", 60),
|
||||
},
|
||||
|
||||
Rabbit: Rabbit{
|
||||
Host: getEnv("RABBIT_HOST", "10.0.0.4"),
|
||||
Port: getEnvPort("RABBIT_PORT", 5672),
|
||||
User: getEnv("RABBIT_USER", "taskProcessorDev"),
|
||||
Pass: getEnv("RABBIT_PASS", "pass1234"),
|
||||
Vhost: getEnv("RABBIT_VHOST", "taskProcessorDevHost"),
|
||||
Host: getEnv("RABBIT_HOST", "10.0.0.4"),
|
||||
Port: getEnvPort("RABBIT_PORT", 5672),
|
||||
User: getEnv("RABBIT_USER", "taskProcessorDev"),
|
||||
Pass: getEnv("RABBIT_PASS", "pass1234"),
|
||||
Vhost: getEnv("RABBIT_VHOST", "taskProcessorDevHost"),
|
||||
LoggingEnabled: getEnvBool("RABBIT_LOGGING_ENABLED", true),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,3 +50,14 @@ func getEnvPort(key string, fallback uint16) uint16 {
|
|||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
func getEnvBool(key string, fallback bool) bool {
|
||||
if value, ok := os.LookupEnv(key); ok {
|
||||
val, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return fallback
|
||||
}
|
||||
return val
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue