Skip to content

Commit

Permalink
fix: remove data handler when sniffer is off
Browse files Browse the repository at this point in the history
  • Loading branch information
Musixal committed Oct 9, 2024
1 parent 41b4826 commit e991cc2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/web/sniffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ func NewDataStore(listenAddr string, shutdownCtx context.Context, snifferLog str

func (m *Usage) Monitor() {
mux := http.NewServeMux()
mux.HandleFunc("/", m.handleIndex) // handle index
mux.HandleFunc("/data", m.handleData) // New route for JSON data
mux.HandleFunc("/", m.handleIndex) // handle index
mux.HandleFunc("/stats", m.statsHandler)

if m.sniffer {
mux.HandleFunc("/data", m.handleData) // New route for JSON data
}
m.server = &http.Server{
Addr: m.listenAddr,
Handler: mux,
Expand Down

0 comments on commit e991cc2

Please sign in to comment.