From 106b1e7e8d35ef7deae2dc2c2cbe27e1c60d3e3e Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 18 Nov 2021 17:51:54 +0000 Subject: [PATCH] Create constants for other reg methods --- api.go | 4 ++-- machine.go | 2 +- oidc.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api.go b/api.go index d11971b6..b8169111 100644 --- a/api.go +++ b/api.go @@ -21,6 +21,8 @@ import ( const ( reservedResponseHeaderSize = 4 RegisterMethodAuthKey = "authKey" + RegisterMethodOIDC = "oidc" + RegisterMethodCLI = "cli" ) // KeyHandler provides the Headscale pub key @@ -422,8 +424,6 @@ func (h *Headscale) handleMachineRefreshKey( return } ctx.Data(http.StatusOK, "application/json; charset=utf-8", respBody) - - return } func (h *Headscale) handleMachineRegistrationNew( diff --git a/machine.go b/machine.go index dcd79700..293b26fa 100644 --- a/machine.go +++ b/machine.go @@ -660,7 +660,7 @@ func (h *Headscale) RegisterMachine( machine.IPAddress = ip.String() machine.NamespaceID = namespace.ID machine.Registered = true - machine.RegisterMethod = "cli" + machine.RegisterMethod = RegisterMethodCLI h.db.Save(&machine) log.Trace(). diff --git a/oidc.go b/oidc.go index 07561e8a..f796c908 100644 --- a/oidc.go +++ b/oidc.go @@ -223,7 +223,7 @@ func (h *Headscale) OIDCCallback(ctx *gin.Context) { machine.IPAddress = ip.String() machine.NamespaceID = namespace.ID machine.Registered = true - machine.RegisterMethod = "oidc" + machine.RegisterMethod = RegisterMethodOIDC machine.LastSuccessfulUpdate = &now h.db.Save(&machine) }