diff --git a/internal/gounicorn/gounicorn.go b/internal/gounicorn/gounicorn.go index 3013d6daa6ed..ded21a4d2c53 100644 --- a/internal/gounicorn/gounicorn.go +++ b/internal/gounicorn/gounicorn.go @@ -17,6 +17,13 @@ import ( "goauthentik.io/internal/utils" ) +var ( + manageCmd string = "./manage.py" + gunicornCmd string = "gunicorn" + gunicornConf string = "./lifecycle/gunicorn.conf.py" + pidDir string = "" +) + type GoUnicorn struct { Healthcheck func() bool healthyCallbacks []func() @@ -58,16 +65,16 @@ func New(healthcheck func() bool) *GoUnicorn { } func (g *GoUnicorn) initCmd() { - command := "./manage.py" + command := manageCmd args := []string{"dev_server"} if !config.Get().Debug { - pidFile, err := os.CreateTemp("", "authentik-gunicorn.*.pid") + pidFile, err := os.CreateTemp(pidDir, "authentik-gunicorn.*.pid") if err != nil { panic(fmt.Errorf("failed to create temporary pid file: %v", err)) } g.pidFile = pidFile.Name() - command = "gunicorn" - args = []string{"-c", "./lifecycle/gunicorn.conf.py", "authentik.root.asgi:application"} + command = gunicornCmd + args = []string{"-c", gunicornConf, "authentik.root.asgi:application"} if g.pidFile != "" { args = append(args, "--pid", g.pidFile) } diff --git a/internal/web/static.go b/internal/web/static.go index 1050bfa2c861..97e58e57bf95 100644 --- a/internal/web/static.go +++ b/internal/web/static.go @@ -64,7 +64,7 @@ func (ws *WebServer) configureStatic() { staticRouter.Use(ws.staticHeaderMiddleware) staticRouter.Use(web.DisableIndex) - distFs := http.FileServer(http.Dir("./web/dist")) + distFs := http.FileServer(staticWeb.StaticDir) pathStripper := func(handler http.Handler, paths ...string) http.Handler { h := handler diff --git a/web/static.go b/web/static.go index 9a5c3d0be794..9ce32f4e6734 100644 --- a/web/static.go +++ b/web/static.go @@ -11,6 +11,8 @@ var RobotsTxt []byte //go:embed security.txt var SecurityTxt []byte -var StaticDir = http.Dir("./web/dist/") +var staticDir = "./web/dist/" + +var StaticDir = http.Dir(staticDir) var StaticHandler = http.FileServer(StaticDir)