Skip to content

Commit

Permalink
fix(agent): broken registration validation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Oct 8, 2023
1 parent f070be7 commit e3ef8f2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/agent/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,14 @@ func (agent *Agent) registrationProcess(ctx context.Context, server, token strin
if server != "" {
if !validateRegistrationSetting("server", server) {
log.Fatal().Msg("Server setting is not valid.")
}
} else {
if err := agent.config.Set(config.PrefHost, token); err != nil {
} else if err := agent.config.Set(config.PrefHost, server); err != nil {
log.Fatal().Err(err).Msg("Could not set host preference.")
}
}
if token != "" {
if !validateRegistrationSetting("token", token) {
log.Fatal().Msg("Token setting is not valid.")
}
} else {
if err := agent.config.Set(config.PrefToken, token); err != nil {
} else if err := agent.config.Set(config.PrefToken, token); err != nil {
log.Fatal().Err(err).Msg("Could not set token preference.")
}
}
Expand Down

0 comments on commit e3ef8f2

Please sign in to comment.