Skip to content
Snippets Groups Projects
Commit c884f669 authored by 邹毅贤's avatar 邹毅贤
Browse files

change init router to config.Load()

parent 9d32b76d
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,7 @@ func (dir *BaseDirectory) SetRouters(urls []*common.URL) {
return
}
routers := make([]router.Router, len(urls), len(urls))
routers := make([]router.Router, 0, len(urls))
for _, url := range urls {
routerKey := url.GetParam(constant.ROUTER_KEY, "")
......
......@@ -36,15 +36,15 @@ var (
metricConfig *MetricConfig
applicationConfig *ApplicationConfig
maxWait = 3
confRouterFile string
)
// loaded consumer & provider config from xxx.yml, and log config from xxx.xml
// Namely: dubbo.consumer.xml & dubbo.provider.xml in java dubbo
func init() {
var (
confConFile string
confProFile string
confRouterFile string
confConFile string
confProFile string
)
confConFile = os.Getenv(constant.CONF_CONSUMER_FILE_PATH)
......@@ -60,10 +60,6 @@ func init() {
log.Printf("[providerInit] %#v", errPro)
providerConfig = nil
}
if errPro := RouterInit(confRouterFile); errPro != nil {
log.Printf("[routerConfig] %#v", errPro)
}
}
func checkRegistries(registries map[string]*RegistryConfig, singleRegistry *RegistryConfig) {
......@@ -82,6 +78,13 @@ func checkApplicationName(config *ApplicationConfig) {
// Load Dubbo Init
func Load() {
// init router
if confRouterFile != "" {
if errPro := RouterInit(confRouterFile); errPro != nil {
log.Printf("[routerConfig init] %#v", errPro)
}
}
// reference config
if consumerConfig == nil {
logger.Warnf("consumerConfig is nil!")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment