From 3af757e26d1d9f3a5f07aa2a6c3b7c495cad5c0b Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 11 Sep 2024 16:32:58 +0100 Subject: [PATCH] rc: fix default value of --metrics-addr Before this fix it was empty string, which isn't a good default for a stringArray. --- fs/rc/rc.go | 2 +- fs/rc/rcserver/metrics.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/rc/rc.go b/fs/rc/rc.go index 9c083f3b7..e41ac9546 100644 --- a/fs/rc/rc.go +++ b/fs/rc/rc.go @@ -85,7 +85,7 @@ var OptionsInfo = fs.Options{{ Groups: "RC", }, { Name: "metrics_addr", - Default: []string{""}, + Default: []string{}, Help: "IPaddress:Port or :Port to bind metrics server to", Groups: "Metrics", }}. diff --git a/fs/rc/rcserver/metrics.go b/fs/rc/rcserver/metrics.go index 502566f47..367e6aeab 100644 --- a/fs/rc/rcserver/metrics.go +++ b/fs/rc/rcserver/metrics.go @@ -37,7 +37,7 @@ func init() { // If the server wasn't configured the *Server returned may be nil func MetricsStart(ctx context.Context, opt *rc.Options) (*MetricsServer, error) { jobs.SetOpt(opt) // set the defaults for jobs - if opt.MetricsHTTP.ListenAddr[0] != "" { + if len(opt.MetricsHTTP.ListenAddr) > 0 { // Serve on the DefaultServeMux so can have global registrations appear s, err := newMetricsServer(ctx, opt) if err != nil {