Imp: load the configure file in another way #1099
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
解决问题:
1、默认使用init初始化,灵活性欠佳,集成进例如cobra这样的框架不够方便,参数存在冲突。
2、原初始化后如果baseconf没有生成,没有相应的set方法重新设置
3、增加baseconf配置文件,优先使用配置文件加载,如不使用配置文件则按原先得方式加载
//保留原初始化方式,把原来的init()中的处理逻辑集成进Load()函数,使用方式不变。
config.Load()
//config_loader 增加option 功能,实现按需初始化。
`
//保留原初始化方式,把原来的init()中的处理逻辑集成进Load()函数,使用方式不变。
config.Load()
//新的初始化方式(按需初始化)
config.LoadWithOptions(config.BaseInitOption(""),config.ConsumerInitOption(confConFile))
//目前转化成6个初始化选项:
//RouterInitOption、ConsumerInitOption、ProviderInitOption、BaseInitOption、ConsumerMustInitOption、ProviderMustInitOption