mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 13:23:07 +01:00
chore: send server id by loading system info (#2936)
This commit is contained in:
15
main.go
15
main.go
@@ -83,7 +83,7 @@ func main() {
|
||||
}
|
||||
|
||||
srv := createServer(args, clients)
|
||||
go doStartEvent(args)
|
||||
go doStartEvent(args, clients)
|
||||
go func() {
|
||||
log.Infof("Accepting connections on %s", srv.Addr)
|
||||
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
|
||||
@@ -104,7 +104,7 @@ func main() {
|
||||
log.Debug("shutdown complete")
|
||||
}
|
||||
|
||||
func doStartEvent(arg args) {
|
||||
func doStartEvent(arg args, clients map[string]docker.Client) {
|
||||
if arg.NoAnalytics {
|
||||
log.Debug("Analytics disabled.")
|
||||
return
|
||||
@@ -115,6 +115,17 @@ func doStartEvent(arg args) {
|
||||
Version: version,
|
||||
}
|
||||
|
||||
if client, ok := clients["localhost"]; ok {
|
||||
event.ServerID = client.SystemInfo().ID
|
||||
event.ServerVersion = client.SystemInfo().ServerVersion
|
||||
} else {
|
||||
for _, client := range clients {
|
||||
event.ServerID = client.SystemInfo().ID
|
||||
event.ServerVersion = client.SystemInfo().ServerVersion
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if err := analytics.SendBeacon(event); err != nil {
|
||||
log.Debug(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user