Skip to content

Commit

Permalink
Debug logging for stored credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Oct 12, 2023
1 parent 91f0b79 commit a29303f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,14 @@ func (app *App) withReusableCredentials(creds SessionCredentials) (err error) {
return fmt.Errorf("failed unmarshalling stored credentials file: %w", err)
}

log.Debugf("stored credentials found for %s", file.Username)
if file.Username == username {
storedCredentials = file.Data
} else {
log.Warnf("stored credentials found for wrong username %s != %s", file.Username, username)
}
} else {
log.Debugf("stored credentials not found")
}

var sess *Session
Expand All @@ -205,6 +210,8 @@ func (app *App) withReusableCredentials(creds SessionCredentials) (err error) {
} else if err := os.WriteFile(app.cfg.CredentialsPath, content, 0600); err != nil {
return fmt.Errorf("failed writing stored credentials file: %w", err)
}

log.Debugf("stored credentials for %s", sess.ap.Username())
}

sess.Run(app.server.Receive())
Expand Down

0 comments on commit a29303f

Please sign in to comment.