Add base site, needs clean-up

This commit is contained in:
2021-12-26 00:02:51 +01:00
parent ed4475149a
commit ec313045f1
28 changed files with 2806 additions and 18 deletions

View File

@@ -17,6 +17,7 @@ import (
"downloader/pkg/common/uuid"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/go-chi/cors"
"net/http"
"time"
)
@@ -49,7 +50,14 @@ func (router *router) setupMiddleware() *router {
router.internalRouter.Use(middleware.RealIP)
router.internalRouter.Use(middleware.Recoverer)
router.internalRouter.Use(middleware.Timeout(time.Second * 60))
router.internalRouter.Use(cors.Handler(cors.Options{
AllowedOrigins: []string{"https://*", "http://*"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link"},
AllowCredentials: false,
MaxAge: 300,
}))
return router
}
@@ -80,6 +88,6 @@ func setupDownloadRoute(router *router) {
downloadApi := download.New(drService)
downloadApi.SetupDownloadApi(router.internalRouter)
cleanupJob := cleanup.New(drRepository, newLogger)
cleanupJob := cleanup.New(drRepository, newLogger, fileOrchestrator)
cleanupJob.RunOnSchedule()
}