Add tray browser enrollment with region picker

The tray helper carried a ServerURL default that nothing read.
Unenrolled users can now open the console /enroll page from the
menu: US, EU, or self-hosted in production, or --server for dev.

Signed-off-by: Ludovic Vielle <ludovic@probo.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ludovic Vielle
2026-07-15 16:56:33 +02:00
parent 952851c743
commit 1329f2a28e
9 changed files with 477 additions and 11 deletions

View File

@@ -44,7 +44,10 @@ func registerTrayAutoStart(exePath string, runDir string) error {
}
func newTrayCmd() *cobra.Command {
var runDir string
var (
runDir string
serverURL string
)
cmd := &cobra.Command{
Use: "tray",
@@ -54,6 +57,15 @@ func newTrayCmd() *cobra.Command {
runDir = deviceagent.DefaultEnrollmentRunDir()
}
if serverURL != "" {
normalized, err := deviceagent.NormalizeServerURL(serverURL)
if err != nil {
return fmt.Errorf("invalid --server: %w", err)
}
serverURL = normalized
}
exePath, err := os.Executable()
if err != nil {
return fmt.Errorf("cannot resolve current executable path: %w", err)
@@ -63,7 +75,7 @@ func newTrayCmd() *cobra.Command {
tray.Options{
RunDir: runDir,
ExePath: exePath,
ServerURL: deviceagent.DefaultServerURL,
ServerURL: serverURL,
Version: version,
},
)
@@ -76,6 +88,12 @@ func newTrayCmd() *cobra.Command {
deviceagent.DefaultEnrollmentRunDir(),
"directory containing the public enrollment marker",
)
cmd.Flags().StringVar(
&serverURL,
"server",
"",
"Probo console base URL; skips region picker when set (for local dev)",
)
return cmd
}