Only print the file content when log the hook.yaml (#22340)

Signed-off-by: SimFG <bang.fu@zilliz.com>
pull/22340/merge
SimFG 2023-02-22 20:55:46 +08:00 committed by GitHub
parent 40878a8656
commit 81f78142ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -111,6 +111,19 @@ func (m *Manager) Configs() map[string]string {
return config
}
func (m *Manager) FileConfigs() map[string]string {
m.RLock()
defer m.RUnlock()
config := make(map[string]string)
for _, source := range m.sources {
if s, ok := source.(*FileSource); ok {
config, _ = s.GetConfigurations()
break
}
}
return config
}
// For compatible reason, only visiable for Test
func (m *Manager) SetConfig(key, value string) {
m.Lock()

View File

@ -201,6 +201,10 @@ func (gp *BaseTable) Configs() map[string]string {
return gp.mgr.Configs()
}
func (gp *BaseTable) FileConfigs() map[string]string {
return gp.mgr.FileConfigs()
}
// Load loads an object with @key.
func (gp *BaseTable) Load(key string) (string, error) {
return gp.mgr.GetConfig(key)

View File

@ -16,7 +16,7 @@ type HookConfig struct {
func (h *HookConfig) init() {
h.Base = &BaseTable{YamlFile: hookYamlFile}
h.Base.Init()
log.Info("hook config", zap.Any("hook", h.Base.Configs()))
log.Info("hook config", zap.Any("hook", h.Base.FileConfigs()))
h.initSoPath()
h.initSoConfig()