From d2879b2b3675c6c38b1a39dd7a7b44c1679287a9 Mon Sep 17 00:00:00 2001 From: Greg Dietsche Date: Wed, 21 May 2025 04:18:53 -0500 Subject: [PATCH] web: change node registration parameter order (#2607) This change makes editing the generated command easier. For example, after pasting into a terminal, the cursor position will be near the username portion which requires editing. --- hscontrol/templates/register_web.go | 2 +- integration/scenario.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hscontrol/templates/register_web.go b/hscontrol/templates/register_web.go index 271f4e7d..967b6573 100644 --- a/hscontrol/templates/register_web.go +++ b/hscontrol/templates/register_web.go @@ -28,7 +28,7 @@ func RegisterWeb(registrationID types.RegistrationID) *elem.Element { elem.H2(nil, elem.Text("Machine registration")), elem.P(nil, elem.Text("Run the command below in the headscale server to add this machine to your network: ")), elem.Code(attrs.Props{attrs.Style: codeStyleRegisterWebAPI.ToInline()}, - elem.Text(fmt.Sprintf("headscale nodes register --user USERNAME --key %s", registrationID.String())), + elem.Text(fmt.Sprintf("headscale nodes register --key %s --user USERNAME", registrationID.String())), ), ), ) diff --git a/integration/scenario.go b/integration/scenario.go index 507c248d..0af1956b 100644 --- a/integration/scenario.go +++ b/integration/scenario.go @@ -842,6 +842,7 @@ func (s *Scenario) runHeadscaleRegister(userStr string, body string) error { return errParseAuthPage } key := keySep[1] + key = strings.SplitN(key, " ", 2)[0] log.Printf("registering node %s", key) if headscale, err := s.Headscale(); err == nil {