print go run in the superuser create installer suggestion if temp dir location is detected

This commit is contained in:
Gani Georgiev 2025-06-24 08:49:21 +03:00
parent db679f9620
commit 3f3b77dcd4
1 changed files with 10 additions and 1 deletions

View File

@ -32,7 +32,7 @@ func DefaultInstallerFunc(app core.App, systemSuperuser *core.Record, baseURL st
_ = osutils.LaunchURL(url)
color.Magenta("\n(!) Launch the URL below in the browser if it hasn't been open already to create your first superuser account:")
color.New(color.Bold).Add(color.FgCyan).Println(url)
color.New(color.FgHiBlack, color.Italic).Printf("(you can also create your first superuser by running: %s superuser upsert EMAIL PASS)\n\n", os.Args[0])
color.New(color.FgHiBlack, color.Italic).Printf("(you can also create your first superuser by running: %s superuser upsert EMAIL PASS)\n\n", executablePath())
return nil
}
@ -86,3 +86,12 @@ func findOrCreateInstallerSuperuser(app core.App) (*core.Record, error) {
return record, nil
}
func executablePath() string {
// most likely ran with go run
if strings.HasPrefix(os.Args[0], os.TempDir()) {
return "go run ."
}
return os.Args[0]
}