gogf / gf

GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
https://goframe.org
MIT License
11.47k stars 1.57k forks source link

os/gcfg: Add configuration change event listener or customize listener #3690

Open LanceAdd opened 1 month ago

LanceAdd commented 1 month ago

Is your feature request related to a problem?

Option Yes

Describe the solution you'd like

Add event listeners or customize listeners. I can customize some behaviors when the configuration changes

g.Cfg().OnChange(f func())

Describe alternatives you've considered

Add event listeners or customize listeners. I can customize some behaviors when the configuration changes

g.Cfg().OnChange(f func())

Additional

No response

LanceAdd commented 1 month ago

I used github.com/nacos-group/nacos-sdk-go/v2 instead of github.com/joy999/nacos-sdk-go, and then combined it with the content of github.com/gogf/gf/contrib/registry/nacos/v2 github.com/gogf/gf/contrib/config/nacos/v2 to write library https://github.com/LanceAdd/nacos-gf as a temporary solution. I hope it can help you.