-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
internal: define package variables for paths #20060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might not be needed since that'll just use TMP by default
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was actually the reason, because I try to avoid storing files in world-writable directories. Indeed it could be set using |
||
| 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) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is required for this, since manage.py is only used during development where you're probably running
go run ./cmd/serverThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pointer, I didn't realize it was overwritten after
!config.Get().Debug. I think it might still be useful though if trying to debug against the system Python environment?