redis-provider-fix
Some checks failed
deploy / deploy (push) Failing after 5s

This commit is contained in:
2024-02-22 11:51:20 +03:00
parent 8fca4cf4c0
commit 31079f2628
5 changed files with 41 additions and 43 deletions

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"strings"
"time"
"os"
"github.com/google/uuid"
@@ -20,7 +19,6 @@ import (
mailService "github.com/authorizerdev/authorizer/server/email"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/memorystore"
"github.com/authorizerdev/authorizer/server/memorystore/providers/redis"
"github.com/authorizerdev/authorizer/server/refs"
"github.com/authorizerdev/authorizer/server/smsproviders"
"github.com/authorizerdev/authorizer/server/token"
@@ -318,19 +316,11 @@ func LoginResolver(ctx context.Context, params model.LoginInput) (*model.AuthRes
expiresIn = 1
}
redisURL := os.Getenv("REDIS_URL")
if redisURL != "" {
log.Info("Initializing Redis memory store")
RedisProvider, err := redis.NewRedisProvider(redisURL)
if err == nil {
appData, err := RedisProvider.GetUserAppDataFromRedis(user.ID)
if err == nil {
// Assign the combined data to the provided pointer
user.AppData = &appData
}
}
}
appData, err := memorystore.Provider.GetUserAppDataFromRedis(user.ID)
if err == nil {
// Assign the combined data to the provided pointer
user.AppData = &appData
}
res = &model.AuthResponse{
Message: `Logged in successfully`,

View File

@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"os"
"time"
"github.com/google/uuid"
@@ -15,7 +14,6 @@ import (
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/memorystore"
"github.com/authorizerdev/authorizer/server/memorystore/providers/redis"
"github.com/authorizerdev/authorizer/server/token"
"github.com/authorizerdev/authorizer/server/utils"
)
@@ -92,19 +90,12 @@ func SessionResolver(ctx context.Context, params *model.SessionQueryInput) (*mod
expiresIn = 1
}
redisURL := os.Getenv("REDIS_URL")
if redisURL != "" {
log.Info("Initializing Redis memory store")
RedisProvider, err := redis.NewRedisProvider(redisURL)
if err != nil {
appData, err := RedisProvider.GetUserAppDataFromRedis(user.ID)
if err == nil {
// Assign the combined data to the provided pointer
user.AppData = &appData
}
}
}
appData, err := memorystore.Provider.GetUserAppDataFromRedis(user.ID)
if err == nil {
// Assign the combined data to the provided pointer
user.AppData = &appData
}
res = &model.AuthResponse{
Message: `Session token refreshed`,
AccessToken: &authToken.AccessToken.Token,