mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-05-03 17:39:53 -05:00
Refactor path prefix handling in router and main functions
This commit is contained in:
+1
-2
@@ -19,7 +19,6 @@ func main() {
|
||||
logger.FatalError("error getting environment variables", logger.KV{"error": err})
|
||||
}
|
||||
|
||||
// Initialize the path prefix utility
|
||||
pathutil.SetPathPrefix(env.PBW_PATH_PREFIX)
|
||||
|
||||
cr, err := cron.New()
|
||||
@@ -48,7 +47,7 @@ func main() {
|
||||
app := echo.New()
|
||||
app.HideBanner = true
|
||||
app.HidePort = true
|
||||
view.MountRouter(app, servs, env)
|
||||
view.MountRouter(app, servs)
|
||||
|
||||
address := env.PBW_LISTEN_HOST + ":" + env.PBW_LISTEN_PORT
|
||||
logger.Info("server started at http://localhost:"+env.PBW_LISTEN_PORT, logger.KV{
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"io/fs"
|
||||
"time"
|
||||
|
||||
"github.com/eduardolat/pgbackweb/internal/config"
|
||||
"github.com/eduardolat/pgbackweb/internal/logger"
|
||||
"github.com/eduardolat/pgbackweb/internal/service"
|
||||
"github.com/eduardolat/pgbackweb/internal/util/pathutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/api"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/middleware"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/static"
|
||||
@@ -14,11 +14,11 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func MountRouter(app *echo.Echo, servs *service.Service, env config.Env) {
|
||||
func MountRouter(app *echo.Echo, servs *service.Service) {
|
||||
mids := middleware.New(servs)
|
||||
|
||||
// Create the base group with the path prefix (if any)
|
||||
baseGroup := app.Group(env.PBW_PATH_PREFIX)
|
||||
baseGroup := app.Group(pathutil.GetPathPrefix())
|
||||
|
||||
browserCache := mids.NewBrowserCacheMiddleware(
|
||||
middleware.BrowserCacheMiddlewareConfig{
|
||||
|
||||
Reference in New Issue
Block a user