config ext
This commit is contained in:
parent
e77521f3aa
commit
3fcd25b769
2 changed files with 17 additions and 6 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package config
|
||||
|
||||
import "runtime"
|
||||
|
||||
type Config struct {
|
||||
App AppConfig
|
||||
Rabbit RabbitMQConfig
|
||||
|
|
@ -9,6 +11,9 @@ type AppConfig struct {
|
|||
Mode string
|
||||
LogLvl string
|
||||
ChanLen uint
|
||||
ExternalBrowser string
|
||||
NumCPUs int
|
||||
TaskTimeoutSeconds int
|
||||
}
|
||||
|
||||
type RabbitMQConfig struct {
|
||||
|
|
@ -28,6 +33,9 @@ func New() *Config {
|
|||
Mode: getEnv("APP_MODE", "dev"),
|
||||
LogLvl: getEnv("APP_LOG_LVL", "debug"),
|
||||
ChanLen: getEnvUint("APP_CHANNEL_LEN", 100),
|
||||
ExternalBrowser: getEnv("APP_EXTERNAL_BROWSER", "http://10.0.0.4:13000"),
|
||||
NumCPUs: getEnvInt("APP_NUMCPUS", runtime.NumCPU()),
|
||||
TaskTimeoutSeconds: getEnvInt("APP_TASK_TIMEOUT_SECONDS", 60),
|
||||
},
|
||||
|
||||
Rabbit: RabbitMQConfig{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
APP_MODE=dev
|
||||
APP_LOG_LVL=debug
|
||||
APP_CHANNEL_LEN=100
|
||||
APP_NUMCPUS=
|
||||
APP_EXTERNAL_BROWSER=
|
||||
APP_TASK_TIMEOUT_SECONDS=
|
||||
|
||||
RABBIT_HOST=
|
||||
RABBIT_PORT=
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue