feat: show daemon config in 'bd daemon --status' output
Add auto-commit, auto-push, local mode, sync interval, and daemon mode to the status output when querying a running daemon. This helps users understand the current daemon configuration without having to check logs or remember what flags were used at startup. Changes: - Add config fields to StatusResponse in protocol.go - Add SetConfig() method to Server for daemon to set its config - Update handleStatus() to include config in response - Update showDaemonStatus() to query and display config via RPC - Add comprehensive test coverage for new functionality Co-authored-by: Christian Catalan <crcatala@gmail.com>
This commit is contained in:
@@ -54,6 +54,12 @@ type Server struct {
|
||||
recentMutations []MutationEvent
|
||||
recentMutationsMu sync.RWMutex
|
||||
maxMutationBuffer int
|
||||
// Daemon configuration (set via SetConfig after creation)
|
||||
autoCommit bool
|
||||
autoPush bool
|
||||
localMode bool
|
||||
syncInterval string
|
||||
daemonMode string
|
||||
}
|
||||
|
||||
// Mutation event types
|
||||
@@ -152,6 +158,17 @@ func (s *Server) MutationChan() <-chan MutationEvent {
|
||||
return s.mutationChan
|
||||
}
|
||||
|
||||
// SetConfig sets the daemon configuration for status reporting
|
||||
func (s *Server) SetConfig(autoCommit, autoPush, localMode bool, syncInterval, daemonMode string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.autoCommit = autoCommit
|
||||
s.autoPush = autoPush
|
||||
s.localMode = localMode
|
||||
s.syncInterval = syncInterval
|
||||
s.daemonMode = daemonMode
|
||||
}
|
||||
|
||||
// ResetDroppedEventsCount resets the dropped events counter and returns the previous value
|
||||
func (s *Server) ResetDroppedEventsCount() int64 {
|
||||
return s.droppedEvents.Swap(0)
|
||||
|
||||
Reference in New Issue
Block a user