File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,14 @@ const (
1717)
1818
1919// SurrealDB connection details.
20- var (
20+ const (
2121 SdbDockerEndpoint = "ws://surrealdb:8000"
2222 SdbNamespace = "tokenbaseNS"
2323 SdbName = "tokenbaseDB"
2424)
2525
2626// Redis connection details.
27- var (
27+ const (
2828 RdbDockerEndpoint = "redis:6379"
2929 RdbDatabase = 0
3030)
Original file line number Diff line number Diff line change 88 "github.com/mitchellh/mapstructure"
99)
1010
11- var (
12- jwtLifetime = time .Hour * 24
13- jwtSecretKey = []byte (GetJwtSecret ())
11+ const (
12+ jwtLifetime = time .Hour * 24
1413)
1514
1615// Generates a JWT for a user.
@@ -29,7 +28,7 @@ func GenerateJwt(user models.ClientUser) (string, error) {
2928 }
3029
3130 token := jwt .NewWithClaims (jwt .SigningMethodHS256 , claims )
32- key := []byte (jwtSecretKey )
31+ key := []byte (GetJwtSecret () )
3332
3433 return token .SignedString (key )
3534}
@@ -44,7 +43,7 @@ func GenerateJwt(user models.ClientUser) (string, error) {
4443// - Any error that occurred.
4544func ValidateJwt (tokenStr string ) (models.ClientUser , error ) {
4645 token , err := jwt .Parse (tokenStr , func (_ * jwt.Token ) (any , error ) {
47- return []byte (jwtSecretKey ), nil
46+ return []byte (GetJwtSecret () ), nil
4847 })
4948
5049 if err != nil {
You can’t perform that action at this time.
0 commit comments