diff --git a/.envrc.example b/.envrc.example index 073ce90c6..9b70f528b 100644 --- a/.envrc.example +++ b/.envrc.example @@ -4,3 +4,12 @@ export CSGHUB_PORTAL_STARHUB_BASE_URL=http://localhost:8080 export CSGHUB_PORTAL_STARHUB_API_KEY=f3a7b9c1d6e5f8e2a1b5d4f9e6a2b8d7c3a4e2b1d9f6e7a8d2c5a7b4c1e3f5b8a1d4f9b7d6e2f8a5d3b1e7f9c6a8b2d1e4f7d5b6e9f2a4b3c8e1d7f995hd82hf export ENABLE_HTTPS=true export CSGHUB_PORTAL_DATABASE_DSN=postgresql://postgres:postgres@localhost:5432/starhub_portal?sslmode=disable +export CSGHUB_PORTAL_DATABASE_DIALECT=pg +export CSGHUB_PORTAL_SIGNUP_URL= +export CSGHUB_PORTAL_LOGIN_URL= +export CSGHUB_PORTAL_S3_ENABLE_SSL=true +export CSGHUB_PORTAL_S3_REGION= +export CSGHUB_PORTAL_S3_ACCESS_KEY_ID= +export CSGHUB_PORTAL_S3_ACCESS_KEY_SECRET= +export CSGHUB_PORTAL_S3_BUCKET= +export CSGHUB_PORTAL_S3_ENDPOINT= diff --git a/internal/routes/router.go b/internal/routes/router.go index c03a7092c..92dab3386 100644 --- a/internal/routes/router.go +++ b/internal/routes/router.go @@ -61,6 +61,7 @@ func Initialize(svcCtx *svc.ServiceContext) (*gin.Engine, error) { setupStaticRouter(g) setupViewsRouter(g, handlersRegistry) setupApiRouter(g, handlersRegistry) + setupNotFoundRouter(g) return g, nil } @@ -217,3 +218,10 @@ func setupApiRouter(g *gin.Engine, handlersRegistry *HandlersRegistry) { internal_api.PUT("/users/jwt_token", handlersRegistry.FrontendHandlers.TokenHandler.RefreshToken) internal_api.POST("/upload", handlersRegistry.FrontendHandlers.UploadHandler.Create) } + +func setupNotFoundRouter(engine *gin.Engine) { + engine.NoRoute(func(ctx *gin.Context) { + ctx.Redirect(http.StatusFound, "/errors/not-found") + ctx.AbortWithStatus(http.StatusNotFound) + }) +} diff --git a/makefile b/makefile index 324a39536..d977e2cf9 100644 --- a/makefile +++ b/makefile @@ -36,12 +36,12 @@ run-backend: build: @echo "Building the project..." cd frontend && yarn build - go build -o app + go build -o csghub-portal ./cmd/csghub-portal # 清理项目 clean: @echo "Cleaning up..." - rm -f app + rm -f csghub-portal # 帮助信息 help: