Skip to content

Commit 37bae0c

Browse files
committed
Fixed lint errors
1 parent ce5e15f commit 37bae0c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

internal/utils/constants.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
)

internal/utils/jwt.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import (
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.
4544
func 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 {

0 commit comments

Comments
 (0)