summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2017-06-29 04:32:27 +0200
committerChristian Pointner <equinox@spreadspace.org>2017-06-29 04:32:27 +0200
commit413f1a9e38fa116b5e663f7f9b73f978c3d101f7 (patch)
tree68ebf34f8760791259194e015c7498c0d19f4013
parentusage of protocols can noe be configured (diff)
add warning if https is enabled but no cert/key is configured
-rw-r--r--src/daq/s5proxy/src/s5proxy/config.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/daq/s5proxy/src/s5proxy/config.go b/src/daq/s5proxy/src/s5proxy/config.go
index 07d4c3c..1aa773a 100644
--- a/src/daq/s5proxy/src/s5proxy/config.go
+++ b/src/daq/s5proxy/src/s5proxy/config.go
@@ -215,6 +215,14 @@ func readConfig(configfile string) (conf *Config, err error) {
conf = &Config{}
conf.SFive.Duration = 10000
- err = json.NewDecoder(f).Decode(conf)
+ if err = json.NewDecoder(f).Decode(conf); err != nil {
+ return
+ }
+ if conf.Protocol == HTTPAndHTTPS || conf.Protocol == HTTPSOnly {
+ if conf.CertFile == "" || conf.KeyFile == "" {
+ return nil, errors.New("HTTPs is enabled but no certificate and/or key file is supplied")
+ }
+ }
+
return
}