Config dump
This commit is contained in:
@@ -4,7 +4,6 @@ type ConfigInterface interface {
|
||||
GetConfig() ZurgConfig
|
||||
GetVersion() string
|
||||
GetToken() string
|
||||
GetTokens() []string
|
||||
GetNumOfWorkers() int
|
||||
GetRefreshEverySecs() int
|
||||
GetRepairEveryMins() int
|
||||
@@ -35,9 +34,8 @@ type ConfigInterface interface {
|
||||
}
|
||||
|
||||
type ZurgConfig struct {
|
||||
Version string `yaml:"zurg" json:"-"`
|
||||
Token string `yaml:"token" json:"-"`
|
||||
Tokens []string `yaml:"tokens" json:"-"`
|
||||
Version string `yaml:"zurg" json:"-"`
|
||||
Token string `yaml:"token" json:"-"`
|
||||
|
||||
ApiTimeoutSecs int `yaml:"api_timeout_secs" json:"api_timeout_secs"`
|
||||
CanRepair bool `yaml:"enable_repair" json:"enable_repair"`
|
||||
@@ -74,10 +72,6 @@ func (z *ZurgConfig) GetToken() string {
|
||||
return z.Token
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetTokens() []string {
|
||||
return z.Tokens
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetHost() string {
|
||||
if z.Host == "" {
|
||||
return "[::]"
|
||||
|
||||
@@ -23,6 +23,16 @@ func loadV1Config(content []byte, log *logutil.Logger) (*ZurgConfigV1, error) {
|
||||
if err := yaml.Unmarshal(content, &configV1); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// don't log token and password
|
||||
bufToken := configV1.Token
|
||||
configV1.Token = strings.Repeat("*", len(bufToken)-4) + bufToken[len(bufToken)-4:]
|
||||
bufPassword := configV1.Password
|
||||
configV1.Password = strings.Repeat("*", len(bufPassword))
|
||||
log.Debugf("Config dump: %+v", configV1)
|
||||
configV1.Token = bufToken
|
||||
configV1.Password = bufPassword
|
||||
|
||||
configV1.log = log
|
||||
return &configV1, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user