aboutsummaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'config.go')
-rw-r--r--config.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/config.go b/config.go
index c76fa94..6605262 100644
--- a/config.go
+++ b/config.go
@@ -2,6 +2,7 @@ package main
import (
"bufio"
+ "crypto/tls"
"os"
"sync"
@@ -15,6 +16,7 @@ var config struct {
Cert string `scfg:"cert"`
Key string `scfg:"key"`
} `scfg:"tls"`
+ _tls_config *tls.Config
}
var config_mutex sync.RWMutex
@@ -31,6 +33,14 @@ func load_config(path string) error {
if err != nil {
return err
}
+ cer, err := tls.LoadX509KeyPair(config.TLS.Cert, config.TLS.Key)
+ if err != nil {
+ return err
+ }
+ config._tls_config = &tls.Config{
+ Certificates: []tls.Certificate{cer},
+ MinVersion: tls.VersionTLS13,
+ }
return nil
}() != nil {
return err