internal: use runserver when debug for code reload

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-15 14:04:10 +01:00
parent b8d86bc482
commit 1a9ace6f9d
1 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"time" "time"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"goauthentik.io/internal/config"
"goauthentik.io/internal/outpost/ak" "goauthentik.io/internal/outpost/ak"
) )
@ -38,6 +39,10 @@ func NewGoUnicorn() *GoUnicorn {
func (g *GoUnicorn) initCmd() { func (g *GoUnicorn) initCmd() {
command := "gunicorn" command := "gunicorn"
args := []string{"-c", "./lifecycle/gunicorn.conf.py", "authentik.root.asgi.app:application"} args := []string{"-c", "./lifecycle/gunicorn.conf.py", "authentik.root.asgi.app:application"}
if config.G.Debug {
command = "./manage.py"
args = []string{"runserver"}
}
g.log.WithField("args", args).WithField("cmd", command).Debug("Starting gunicorn") g.log.WithField("args", args).WithField("cmd", command).Debug("Starting gunicorn")
g.p = exec.Command(command, args...) g.p = exec.Command(command, args...)
g.p.Env = os.Environ() g.p.Env = os.Environ()