From c6a9a816f6aa05c8d7fbaa5751f26e6d78fb8073 Mon Sep 17 00:00:00 2001 From: yusing Date: Mon, 4 Nov 2024 00:31:34 +0800 Subject: [PATCH] copied default config into docker image, fixed ls-routes --- Dockerfile | 3 +++ cmd/main.go | 7 +++++-- internal/docker/container.go | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7234efa..af1f332 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,9 @@ COPY --from=builder /app /app # copy schema directory COPY schema/ /app/schema/ +# copy example config +COPY config.example.yml /app/config/config.yml + # copy certs COPY --from=builder /etc/ssl/certs /etc/ssl/certs diff --git a/cmd/main.go b/cmd/main.go index e79aa2a..45d4223 100755 --- a/cmd/main.go +++ b/cmd/main.go @@ -48,11 +48,10 @@ func main() { if err != nil { log.Printf("failed to connect to api server: %s", err) log.Printf("falling back to config file") - printJSON(config.RoutesByAlias()) } else { printJSON(routes) + return } - return case common.CommandDebugListMTrace: trace, err := query.ListMiddlewareTraces() if err != nil { @@ -95,6 +94,10 @@ func main() { } switch args.Command { + case common.CommandListRoutes: + cfg.StartProxyProviders() + printJSON(config.RoutesByAlias()) + return case common.CommandListConfigs: printJSON(config.Value()) return diff --git a/internal/docker/container.go b/internal/docker/container.go index f87535f..f17cdbf 100644 --- a/internal/docker/container.go +++ b/internal/docker/container.go @@ -20,7 +20,7 @@ type ( ContainerID string `json:"container_id" yaml:"-"` ImageName string `json:"image_name" yaml:"-"` - Labels map[string]string `json:"labels" yaml:"-"` + Labels map[string]string `json:"-" yaml:"-"` PublicPortMapping PortMapping `json:"public_ports" yaml:"-"` // non-zero publicPort:types.Port PrivatePortMapping PortMapping `json:"private_ports" yaml:"-"` // privatePort:types.Port