From 3ccd8caa236d749aa2dfb652c228f00680052869 Mon Sep 17 00:00:00 2001 From: AlxCzl Date: Tue, 1 Dec 2020 20:05:51 +0100 Subject: [PATCH] [GO][EDIT] Added tls flag in config file --- config/config.go | 1 + main.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 6dabc6c..3a29cba 100644 --- a/config/config.go +++ b/config/config.go @@ -9,6 +9,7 @@ import ( // Config represents the configuration for the exporter type Config struct { + tls bool `yaml:"tls,omitempty"` Devices []Device `yaml:"devices"` Features struct { BGP bool `yaml:"bgp,omitempty"` diff --git a/main.go b/main.go index 3adb4d0..cdec72c 100644 --- a/main.go +++ b/main.go @@ -245,7 +245,8 @@ func collectorOptions() []collector.Option { opts = append(opts, collector.WithTimeout(*timeout)) } - if *tls { + if *tls || cfg.tls { + fmt.printf("TLS activated\n"); opts = append(opts, collector.WithTLS(*insecure)) }