mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 21:33:18 +01:00
fixes nil pointer
This commit is contained in:
@@ -307,6 +307,7 @@ func (c *Client) ListContainers(ctx context.Context, filter docker.ContainerFilt
|
||||
in := &pb.ListContainersRequest{}
|
||||
|
||||
if filter != nil {
|
||||
in.Filter = make(map[string]*pb.RepeatedString)
|
||||
for k, v := range filter {
|
||||
in.Filter[k] = &pb.RepeatedString{Values: v}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package docker_support
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/amir20/dozzle/internal/agent"
|
||||
"github.com/amir20/dozzle/internal/docker"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type agentService struct {
|
||||
@@ -37,6 +39,7 @@ func (a *agentService) StreamLogs(ctx context.Context, container docker.Containe
|
||||
}
|
||||
|
||||
func (a *agentService) ListContainers(ctx context.Context, filter docker.ContainerFilter) ([]docker.Container, error) {
|
||||
log.Debug().Interface("filter", filter).Msg("Listing containers from agent")
|
||||
return a.client.ListContainers(ctx, filter)
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ func (h *handler) streamEvents(w http.ResponseWriter, r *http.Request) {
|
||||
h.multiHostService.SubscribeEventsAndStats(r.Context(), events, stats)
|
||||
h.multiHostService.SubscribeAvailableHosts(r.Context(), availableHosts)
|
||||
|
||||
// TODO - No user data so just fetch all containers
|
||||
allContainers, errors := h.multiHostService.ListAllContainers(docker.ContainerFilter{})
|
||||
allContainers, errors := h.multiHostService.ListAllContainers(h.config.Filter)
|
||||
|
||||
for _, err := range errors {
|
||||
log.Warn().Err(err).Msg("error listing containers")
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/amir20/dozzle/internal/auth"
|
||||
"github.com/amir20/dozzle/internal/docker"
|
||||
docker_support "github.com/amir20/dozzle/internal/support/docker"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
@@ -33,6 +34,7 @@ type Config struct {
|
||||
Dev bool
|
||||
Authorization Authorization
|
||||
EnableActions bool
|
||||
Filter docker.ContainerFilter
|
||||
}
|
||||
|
||||
type Authorization struct {
|
||||
|
||||
Reference in New Issue
Block a user