/
config.go
44 lines (36 loc) · 1.03 KB
/
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
41
42
43
44
// Code generated with jinja2 templates. DO NOT EDIT.
package store
type StoreConfig struct {
Enabled bool `json:"enabled" yaml:"Enabled"`
Plugin string `json:"plugin,omitempty" yaml:"Plugin,omitempty"`
Addresses []string `json:"addresses,omitempty" yaml:"Addresses,omitempty"`
Database string `json:"database,omitempty" yaml:"Database,omitempty"`
Table string `json:"table,omitempty" yaml:"Table,omitempty"`
}
type Config struct {
Store StoreConfig `json:"broker" yaml:"Store"`
}
func NewConfig() *Config {
return &Config{
Store: StoreConfig{
Enabled: false,
Plugin: "",
Addresses: []string{},
Database: "",
Table: "",
},
}
}
func (d *Config) Merge(src *Config) error {
def := NewConfig()
if src.Store.Enabled != def.Store.Enabled {
d.Store.Enabled = src.Store.Enabled
}
if src.Store.Plugin != def.Store.Plugin {
d.Store.Plugin = src.Store.Plugin
d.Store.Addresses = src.Store.Addresses
d.Store.Database = src.Store.Database
d.Store.Table = src.Store.Table
}
return nil
}