Skip to content

Commit

Permalink
fix(agent): correct logic for retrieving token and server from regist…
Browse files Browse the repository at this point in the history
…ration details
  • Loading branch information
joshuar committed Jul 16, 2023
1 parent fcf1820 commit 0be94be
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions internal/agent/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,23 @@ type RegistrationDetails struct {
}

func (r *RegistrationDetails) Server() string {
if s, err := r.serverBinding.Get(); err != nil {
return s
var s string
var err error
if s, err = r.serverBinding.Get(); err != nil {
log.Warn().Err(err).Msg("Unable to retrieve server from registration details.")
return ""
}
return ""
return s
}

func (r *RegistrationDetails) Token() string {
if s, err := r.tokenBinding.Get(); err != nil {
return s
var s string
var err error
if s, err = r.tokenBinding.Get(); err != nil {
log.Warn().Err(err).Msg("Unable to retrieve token from registration details.")
return ""
}
return ""
return s
}

func (r *RegistrationDetails) Validate() bool {
Expand Down

0 comments on commit 0be94be

Please sign in to comment.