chore: Update database configuration and enhance error handling

- Changed database credentials in start.sh for testing purposes.
- Added environment variable for testing and allowed origins in start.sh.
- Improved error handling in yggdrasil_auth_service.go by checking for nil user before returning an error.
This commit is contained in:
lan
2025-12-04 22:35:03 +08:00
parent 8858fd1ede
commit 432c47d969
2 changed files with 8 additions and 3 deletions

View File

@@ -42,6 +42,9 @@ func (s *yggdrasilAuthService) GetUserIDByEmail(ctx context.Context, email strin
if err != nil { if err != nil {
return 0, apperrors.ErrUserNotFound return 0, apperrors.ErrUserNotFound
} }
if user == nil {
return 0, apperrors.ErrUserNotFound
}
return user.ID, nil return user.ID, nil
} }

View File

@@ -5,9 +5,9 @@
# 设置环境变量 # 设置环境变量
export DATABASE_HOST=192.168.10.205 export DATABASE_HOST=192.168.10.205
export DATABASE_PORT=5432 export DATABASE_PORT=5432
export DATABASE_USERNAME=skin3 export DATABASE_USERNAME=test
export DATABASE_PASSWORD=lanyimin123 export DATABASE_PASSWORD=eFjAbSWJNDFe8NQz
export DATABASE_NAME=skin3 export DATABASE_NAME=test
export DATABASE_SSL_MODE=disable export DATABASE_SSL_MODE=disable
export DATABASE_TIMEZONE=Asia/Shanghai export DATABASE_TIMEZONE=Asia/Shanghai
@@ -28,6 +28,8 @@ export RUSTFS_USE_SSL=false
export EMAIL_ENABLED=false export EMAIL_ENABLED=false
export Environment=test
export SECURITY_ALLOWED_ORIGINS=*
export LOG_LEVEL=info export LOG_LEVEL=info
export LOG_FORMAT=json export LOG_FORMAT=json
export LOG_OUTPUT=logs/app.log export LOG_OUTPUT=logs/app.log