diff options
author | Christian Pointner <equinox@spreadspace.org> | 2017-06-29 04:32:27 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2017-06-29 04:32:27 +0200 |
commit | 413f1a9e38fa116b5e663f7f9b73f978c3d101f7 (patch) | |
tree | 68ebf34f8760791259194e015c7498c0d19f4013 /src/daq | |
parent | usage of protocols can noe be configured (diff) |
add warning if https is enabled but no cert/key is configured
Diffstat (limited to 'src/daq')
-rw-r--r-- | src/daq/s5proxy/src/s5proxy/config.go | 10 |
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 } |