Skip to content

Commit

Permalink
update sentinel to v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gorexlv committed Sep 7, 2020
1 parent 37b5b6a commit 7d67a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/store/mongo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func main() {
}

func (eng *Engine) exampleMongo() (err error) {
session := mongo.StdNew("test")
session := mongo.StdConfig("test").Build()
defer session.Close()

// write
Expand Down
10 changes: 5 additions & 5 deletions pkg/sentinel/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ package sentinel
import (
"encoding/json"
"io/ioutil"
"os"

sentinel "github.com/alibaba/sentinel-golang/api"
"github.com/alibaba/sentinel-golang/core/base"
sentinel_config "github.com/alibaba/sentinel-golang/core/config"
"github.com/alibaba/sentinel-golang/core/flow"
"github.com/douyu/jupiter/pkg"
"github.com/douyu/jupiter/pkg/conf"
"github.com/douyu/jupiter/pkg/constant"
"github.com/douyu/jupiter/pkg/xlog"
)

Expand Down Expand Up @@ -78,13 +77,14 @@ func (config *Config) Build() error {
config.FlowRules = append(config.FlowRules, rules...)
}

_ = os.Setenv(constant.EnvKeySentinelAppName, config.AppName)
_ = os.Setenv(constant.EnvKeySentinelLogDir, config.LogPath)
configEntity := sentinel_config.NewDefaultConfig()
configEntity.Sentinel.App.Name = config.AppName
configEntity.Sentinel.Log.Dir = config.LogPath

if len(config.FlowRules) > 0 {
_, _ = flow.LoadRules(config.FlowRules)
}
return sentinel.InitDefault()
return sentinel.InitWithConfig(configEntity)
}

func Entry(resource string) (*base.SentinelEntry, *base.BlockError) {
Expand Down

0 comments on commit 7d67a7a

Please sign in to comment.