1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-28 07:56:37 +01:00

fix: fixes broken host info for remote hosts. fixes #3103

This commit is contained in:
Amir Raminfar
2024-07-14 15:46:02 -07:00
parent c5e3fbcd3f
commit 6c153051c9
3 changed files with 12 additions and 15 deletions

View File

@@ -82,25 +82,20 @@ type httpClient struct {
}
func NewClient(cli DockerCLI, filters filters.Args, host Host) Client {
client := &httpClient{
cli: cli,
filters: filters,
host: host,
}
var err error
client.info, err = cli.Info(context.Background())
info, err := cli.Info(context.Background())
if err != nil {
log.Errorf("unable to get docker info: %v", err)
}
if host.MemTotal == 0 || host.NCPU == 0 {
host.NCPU = client.info.NCPU
host.MemTotal = client.info.MemTotal
host.NCPU = info.NCPU
host.MemTotal = info.MemTotal
return &httpClient{
cli: cli,
filters: filters,
host: host,
}
log.Debugf("Creating a client with host: %+v", host)
return client
}
// NewClientWithFilters creates a new instance of Client with docker filters