Skip to content

Commit

Permalink
give app,version,service param (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxiaoliang authored Jul 22, 2019
1 parent e7200c2 commit ffc26da
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
module github.com/go-chassis/go-archaius

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.7
github.com/go-chassis/go-chassis-config v0.8.0
github.com/go-chassis/go-chassis-config v0.9.0
github.com/go-mesh/openlogging v1.0.0
github.com/gorilla/websocket v1.4.0
github.com/pkg/errors v0.8.1 // indirect
github.com/spf13/cast v1.2.0
github.com/stretchr/testify v1.3.0
golang.org/x/sys v0.0.0-20180824143301-4910a1d54f87 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1
gopkg.in/yaml.v2 v2.2.1
)

Expand Down
12 changes: 5 additions & 7 deletions sources/configcenter/configcenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ var (

//Handler handles configs from config center
type Handler struct {
Service string
Version string
App string
Env string
cc config.Client
dynamicConfigHandler *DynamicConfigHandler
dimensionInfoMap map[string]string
Expand All @@ -67,7 +63,6 @@ var ConfigCenterConfig *Handler
//NewConfigCenterSource initializes all components of configuration center
func NewConfigCenterSource(cc config.Client,
refreshMode, refreshInterval int) core.ConfigSource {

if ConfigCenterConfig == nil {
ConfigCenterConfig = new(Handler)
ConfigCenterConfig.priority = configCenterSourcePriority
Expand Down Expand Up @@ -152,12 +147,15 @@ func (cfgSrcHandler *Handler) refreshConfigurations(dimensionInfo string) error
)

if dimensionInfo == "" {
config, err = cfgSrcHandler.cc.PullConfigs(cfgSrcHandler.Service,
cfgSrcHandler.Version, cfgSrcHandler.App, cfgSrcHandler.Env)
config, err = cfgSrcHandler.cc.PullConfigs(cfgSrcHandler.cc.Options().ServiceName,
cfgSrcHandler.cc.Options().Version, cfgSrcHandler.cc.Options().App, cfgSrcHandler.cc.Options().Env)
if err != nil {
openlogging.GetLogger().Warnf("Failed to pull configurations from config center server", err) //Warn
return err
}
openlogging.Debug("pull configs", openlogging.WithTags(openlogging.Tags{
"config": config,
}))
//Populate the events based on the changed value between current config and newly received Config
events, err = cfgSrcHandler.populateEvents(config)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package envconfigsource

import (
"github.com/go-chassis/go-archaius/core"
"gopkg.in/go-playground/assert.v1"
"github.com/stretchr/testify/assert"
"os"
"testing"
)
Expand Down

0 comments on commit ffc26da

Please sign in to comment.