-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve config center #1030
Improve config center #1030
Conversation
e7e1006
to
f4be162
Compare
pls change the target branch to 1.5 |
f4be162
to
e703ce9
Compare
Codecov Report
@@ Coverage Diff @@
## 1.5 #1030 +/- ##
==========================================
+ Coverage 59.53% 59.65% +0.11%
==========================================
Files 259 261 +2
Lines 12737 12943 +206
==========================================
+ Hits 7583 7721 +138
- Misses 4199 4248 +49
- Partials 955 974 +19
Continue to review full report at Codecov.
|
Updated. |
if consumerConfig.CacheFile != "" { | ||
if data, err := yaml.MarshalYML(consumerConfig); err != nil { | ||
logger.Errorf("Marshal consumer config err: %s", err.Error()) | ||
} else { | ||
if err := ioutil.WriteFile(consumerConfig.CacheFile, data, 0666); err != nil { | ||
logger.Errorf("Write consumer config cache file err: %s", err.Error()) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether we should do this like:
(c *consumerConfig) SaveToCacheFile() {
// ...
}
// in this funtion
consumerConfig.SaveToFile()
// Write the current configuration to cache file. | ||
if providerConfig.CacheFile != "" { | ||
if data, err := yaml.MarshalYML(providerConfig); err != nil { | ||
logger.Errorf("Marshal provider config err: %s", err.Error()) | ||
} else { | ||
if err := ioutil.WriteFile(providerConfig.CacheFile, data, 0666); err != nil { | ||
logger.Errorf("Write provider config cache file err: %s", err.Error()) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my above comment
if data, err := yaml.MarshalYML(consumerConfig); err != nil { | ||
logger.Errorf("Marshal consumer config err: %s", err.Error()) | ||
} else { | ||
if err := ioutil.WriteFile(consumerConfig.CacheFile, data, 0666); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can not get this point. why will you copy this config to a new file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the issue comment: #729 (comment).
415e245
to
698908d
Compare
@@ -50,6 +50,9 @@ type BaseConfig struct { | |||
EventDispatcherType string `default:"direct" yaml:"event_dispatcher_type" json:"event_dispatcher_type,omitempty"` | |||
MetricConfig *MetricConfig `yaml:"metrics" json:"metrics,omitempty"` | |||
fileStream *bytes.Buffer | |||
|
|||
// cache file used to store the current used configurations. | |||
CacheFile string `yaml:"cache_file" json:"cache_file,omitempty" property:"cache_file"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find where to use this field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see config_loader.go
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you write provider config to CacheFile, but I want to know where to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the issue comment: #729 (comment).
…enter Improve config center
What this PR does:
Which issue(s) this PR fixes:
Fixes #729
Special notes for your reviewer:
Does this PR introduce a user-facing change?: