-
Notifications
You must be signed in to change notification settings - Fork 784
/
config.go
37 lines (30 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
package rulestore
import (
"flag"
"reflect"
"github.com/cortexproject/cortex/pkg/configs/client"
"github.com/cortexproject/cortex/pkg/ruler/rulestore/configdb"
"github.com/cortexproject/cortex/pkg/ruler/rulestore/local"
"github.com/cortexproject/cortex/pkg/storage/bucket"
"github.com/cortexproject/cortex/pkg/util/flagext"
)
// Config configures a rule store.
type Config struct {
bucket.Config `yaml:",inline"`
ConfigDB client.Config `yaml:"configdb"`
Local local.Config `yaml:"local"`
}
// RegisterFlags registers the backend storage config.
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
prefix := "ruler-storage."
cfg.ExtraBackends = []string{configdb.Name, local.Name}
cfg.ConfigDB.RegisterFlagsWithPrefix(prefix, f)
cfg.Local.RegisterFlagsWithPrefix(prefix, f)
cfg.RegisterFlagsWithPrefix(prefix, f)
}
// IsDefaults returns true if the storage options have not been set.
func (cfg *Config) IsDefaults() bool {
defaults := Config{}
flagext.DefaultValues(&defaults)
return reflect.DeepEqual(*cfg, defaults)
}