diff --git a/pkg/metrics/service.go b/pkg/metrics/service.go index a253ea93..03888d9b 100644 --- a/pkg/metrics/service.go +++ b/pkg/metrics/service.go @@ -68,10 +68,16 @@ func New(ctx context.Context, idCfg *config.IdentityConfig) (daemon.Daemon, erro ListenAddress: idCfg.MetricsServerAddr, SystemdSocket: false, ConfigFile: "", - Files: []string{ - idCfg.CertFile, - idCfg.CaCertFile, - }, + Files: func() []string { + files := []string{} + if idCfg.CertFile != "" { + files = append(files, idCfg.CertFile) + } + if idCfg.CaCertFile != "" { + files = append(files, idCfg.CaCertFile) + } + return files + }(), Directories: []string{}, YAMLs: []string{}, TrimPathComponents: 0,