aboutsummaryrefslogtreecommitdiff
path: root/https
diff options
context:
space:
mode:
authorGoutham Veeramachaneni <gouthamve@gmail.com>2020-04-16 08:58:51 +0100
committerJohannes 'fish' Ziemke <github@freigeist.org>2020-04-17 12:02:31 +0200
commitbd0918f29abd1d06e1c7dc521bab73b5104cc259 (patch)
tree113d46cdf8b016c3f5307bc8c2ae480ffd3d571d /https
parentb14168cf6ad2fd40bbe53b29eebea149dae31105 (diff)
downloadprometheus_node_collector-bd0918f29abd1d06e1c7dc521bab73b5104cc259.tar.bz2
prometheus_node_collector-bd0918f29abd1d06e1c7dc521bab73b5104cc259.tar.xz
prometheus_node_collector-bd0918f29abd1d06e1c7dc521bab73b5104cc259.zip
Expose the function to generate tls.Config
We're looking to reuse this in Cortex to client side encrypt our connections and not having this exposed is making us copy this entire function. Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
Diffstat (limited to 'https')
-rw-r--r--https/tls_config.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/https/tls_config.go b/https/tls_config.go
index dd473d8..423c267 100644
--- a/https/tls_config.go
+++ b/https/tls_config.go
@@ -45,10 +45,11 @@ func getTLSConfig(configPath string) (*tls.Config, error) {
45 if err != nil { 45 if err != nil {
46 return nil, err 46 return nil, err
47 } 47 }
48 return configToTLSConfig(&c.TLSConfig) 48 return ConfigToTLSConfig(&c.TLSConfig)
49} 49}
50 50
51func configToTLSConfig(c *TLSStruct) (*tls.Config, error) { 51// ConfigToTLSConfig generates the golang tls.Config from the TLSStruct config.
52func ConfigToTLSConfig(c *TLSStruct) (*tls.Config, error) {
52 cfg := &tls.Config{} 53 cfg := &tls.Config{}
53 if len(c.TLSCertPath) == 0 { 54 if len(c.TLSCertPath) == 0 {
54 return nil, errors.New("missing TLSCertPath") 55 return nil, errors.New("missing TLSCertPath")