35 lines
922 B
Go
35 lines
922 B
Go
package modules
|
|
|
|
import (
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/lego/core/cbase"
|
|
"go_dreamfactory/sys/configure"
|
|
)
|
|
|
|
///配置管理基础组件
|
|
type MComp_Configure struct {
|
|
cbase.ModuleCompBase
|
|
S base.IRPCXService //rpc服务对象
|
|
M IModule //当前业务模块
|
|
}
|
|
|
|
//组件初始化接口
|
|
func (this *MComp_Configure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
this.ModuleCompBase.Init(service, module, comp, options)
|
|
this.S = service.(base.IRPCXService)
|
|
this.M = module.(IModule)
|
|
return
|
|
}
|
|
|
|
//加载配置文件
|
|
func (this *MComp_Configure) LoadConfigure(name string, fn interface{}) (err error) {
|
|
configure.RegisterConfigure(name, fn)
|
|
return
|
|
}
|
|
|
|
//读取配置数据
|
|
func (this *MComp_Configure) GetConfigure(name string) (v interface{}, err error) {
|
|
return configure.GetConfigure(name)
|
|
}
|