A lot of thigs are going on
All checks were successful
ci/woodpecker/push/build Pipeline was successful

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2026-05-10 23:14:29 +02:00
parent 16fab87949
commit 33f48f2bfb
31 changed files with 72 additions and 1514 deletions

18
main.go
View File

@@ -10,9 +10,8 @@ import (
"time"
v1 "gitea.badhouseplants.net/softplayer/softplayer-backend/api/v1"
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/authorization"
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/controllers"
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/tools/logger"
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/logger"
accounts "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts/v1"
test "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/test/v1"
"github.com/alecthomas/kong"
@@ -160,13 +159,19 @@ func server(ctx context.Context, params Serve) error {
}
authReqServices := func(ctx context.Context, callMeta interceptors.CallMeta) bool {
return !strings.Contains(callMeta.Service, "NoAuth")
serviceParts := strings.Split(callMeta.Service, ".")
if len(serviceParts) == 0 {
return false
}
serviceName := serviceParts[len(serviceParts)-1]
fmt.Println(serviceName)
return !strings.HasPrefix(serviceName, "Public")
}
rdb := redis.NewClient(&redis.Options{
Addr: params.RedisHost,
})
authInterceptor := authorization.NewAuthController(
authInterceptor := controllers.NewAuthController(
[]byte(params.JWTSecret),
params.AccessTokenTTL,
params.RefrestTokenTTL,
@@ -195,8 +200,9 @@ func server(ctx context.Context, params Serve) error {
JWTSecret: []byte(params.JWTSecret),
Redis: rdb,
}
accounts.RegisterAccountsNoAuthServiceServer(grpcServer, v1.NewAccountNoAuthRPCImpl(accountCtrl, authInterceptor))
accounts.RegisterAccountsAuthServiceServer(grpcServer, v1.NewAccountAuthRPCImpl(accountCtrl, authInterceptor))
accounts.RegisterPublicAccountsServiceServer(grpcServer, v1.NewAccountNoAuthRPCImpl(accountCtrl, authInterceptor))
accounts.RegisterAccountsServiceServer(grpcServer, v1.NewAccountAuthRPCImpl(accountCtrl, authInterceptor))
test.RegisterTestAuthServiceServer(grpcServer, v1.NewTestAuthRPCImpl())
test.RegisterTestNoAuthServiceServer(grpcServer, v1.NewTestNoAuthRPCImpl())
if err := grpcServer.Serve(lis); err != nil {