-
Notifications
You must be signed in to change notification settings - Fork 4
/
defaults.go
43 lines (36 loc) · 1022 Bytes
/
defaults.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"github.com/spf13/viper"
"github.com/teamnsrg/mida/log"
"os"
)
// initViperConfig
func initViperConfig() {
// Initialize the hardcoded defaults
setDefaults()
// We will read environment variables with the "MIDA" prefix
viper.SetEnvPrefix("MIDA")
viper.AutomaticEnv()
cwd, err := os.Getwd()
if err != nil {
log.Log.Fatal(err)
}
viper.Set("cwd", cwd)
}
// Hardcoded default configuration values
func setDefaults() {
// MIDA-Wide Configuration Defaults
viper.SetDefault("crawlers", 1)
viper.SetDefault("postprocessers", 1)
viper.SetDefault("storers", 1)
viper.SetDefault("prom_port", 8001)
viper.SetDefault("monitor", false)
viper.SetDefault("log_level", 2)
viper.SetDefault("task_file", "examples/example_task.json")
viper.SetDefault("rate_limit", 200)
viper.SetDefault("tempdir", ".midatmp")
viper.SetDefault("amqp_user", "")
viper.SetDefault("amqp_pass", "")
viper.SetDefault("amqp_uri", "amqp://localhost:5672")
viper.SetDefault("amqp_task_queue", "mida-tasks")
}