-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_config.go
40 lines (33 loc) · 936 Bytes
/
build_config.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
package valhalla
import "encoding/json"
type Config struct {
Json map[string]interface{}
}
func DefaultConfig() *Config {
var config map[string]interface{}
err := json.Unmarshal([]byte(defaultConfigString), &config)
if err != nil {
panic(err)
}
return &Config{Json: config}
}
func (config *Config) String() string {
marshal, err := json.Marshal(config.Json)
if err != nil {
return err.Error()
}
return string(marshal)
}
func (config *Config) SetTileDirPath(path string) {
mjolnir := config.Json["mjolnir"].(map[string]interface{})
mjolnir["tile_dir"] = path
}
func (config *Config) SetTileExtractPath(path string) {
mjolnir := config.Json["mjolnir"].(map[string]interface{})
mjolnir["tile_extract"] = path
}
func (config *Config) SetLoggingVerbosity(verbose bool) {
mjolnir := config.Json["mjolnir"].(map[string]interface{})
logging := mjolnir["logging"].(map[string]interface{})
logging["type"] = verbose
}