Skip to content

Commit

Permalink
add set GoFrame server name
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Apr 5, 2020
1 parent ab8122e commit fc4352f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 4 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Change Log 更新说明
------------------------------
## 2020-04-1 v1.3.16
## 2020-04-05 v1.3.17
1. 支持配置GoFrame serverName字段,默认不需要配置;

## 2020-04-01 v1.3.16
1. 支持路径排除配置

## 2020-03-31 v1.3.15
Expand Down
13 changes: 9 additions & 4 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import (
"github.com/gogf/gf/text/gstr"
)

var TestServerName string

//var TestServerName string = "gtoken"

func main() {
g.Server().Run()
g.Server(TestServerName).Run()
}

// 管理初始化顺序.
Expand All @@ -24,7 +28,7 @@ func initConfig() {

v := g.View()
c := g.Config()
s := g.Server()
s := g.Server(TestServerName)

path := ""
// 配置对象及视图对象配置
Expand Down Expand Up @@ -53,7 +57,7 @@ func initConfig() {
*/
func bindRouter() {

s := g.Server()
s := g.Server(TestServerName)
s.BindMiddleware("/*", CORS)

// 调试路由
Expand All @@ -73,6 +77,7 @@ func bindRouter() {
loginFunc := Login
// 启动gtoken
gfToken := &gtoken.GfToken{
ServerName: TestServerName,
//Timeout: 10 * 1000,
CacheMode: g.Config().GetInt8("gtoken.cache-mode"),
LoginPath: "/login",
Expand All @@ -92,7 +97,7 @@ func bindRouter() {
*/
func initRouter() {

s := g.Server()
s := g.Server(TestServerName)

// 绑定路由
bindRouter()
Expand Down
4 changes: 3 additions & 1 deletion gtoken/gtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const (

// GfToken gtoken结构体
type GfToken struct {
// GoFrame server name
ServerName string
// 缓存模式 1 gcache 2 gredis 默认1
CacheMode int8
// 缓存key
Expand Down Expand Up @@ -168,7 +170,7 @@ func (m *GfToken) Start() bool {
}
glog.Info("[GToken][params:" + m.String() + "]start... ")

s := g.Server()
s := g.Server(m.ServerName)

// 缓存模式
if m.CacheMode > CacheModeRedis {
Expand Down

0 comments on commit fc4352f

Please sign in to comment.