forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
38 lines (30 loc) · 1019 Bytes
/
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
package rulestore
import (
"flag"
"reflect"
"github.com/grafana/dskit/flagext"
"github.com/pao214/loki/v2/pkg/configs/client"
"github.com/pao214/loki/v2/pkg/ruler/rulestore/configdb"
"github.com/pao214/loki/v2/pkg/ruler/rulestore/local"
"github.com/pao214/loki/v2/pkg/storage/bucket"
)
// 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)
}