Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
eddycjy committed May 19, 2019
1 parent 68159a4 commit 6616851
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import (
"github.com/EDDYCJY/go-gin-example/pkg/logging"
"github.com/EDDYCJY/go-gin-example/pkg/setting"
"github.com/EDDYCJY/go-gin-example/routers"
"github.com/EDDYCJY/go-gin-example/pkg/util"
)

func init() {
setting.Setup()
models.Setup()
logging.Setup()
gredis.Setup()
util.Setup()
}

// @title Golang Gin API
Expand Down
5 changes: 2 additions & 3 deletions pkg/util/jwt.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package util

import (
"github.com/dgrijalva/jwt-go"
"time"

"github.com/EDDYCJY/go-gin-example/pkg/setting"
"github.com/dgrijalva/jwt-go"
)

var jwtSecret = []byte(setting.AppSetting.JwtSecret)
var jwtSecret []byte

type Claims struct {
Username string `json:"username"`
Expand Down
8 changes: 8 additions & 0 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package util

import "github.com/EDDYCJY/go-gin-example/pkg/setting"

// Setup Initialize the util
func Setup() {
jwtSecret = []byte(setting.AppSetting.JwtSecret)
}

0 comments on commit 6616851

Please sign in to comment.