diff --git a/ipe/config-example.json b/ipe/config-example.json index d86cabe..434e599 100644 --- a/ipe/config-example.json +++ b/ipe/config-example.json @@ -1,6 +1,7 @@ { "Host": ":8080", "Encrypted": true, + "SSLHost": ":8090", "SSLPrivateKey": "/home/ssl.key", "SSLPublicKey": "/home/ssl.crt", "Apps": [ @@ -8,6 +9,7 @@ "ApplicationDisabled": false, "Secret": "7ad3753142a6693b25b9", "Key": "278d525bdf162c739803", + "OnlySSL": false, "Name": "App 1", "AppID": "321", "UserEvents": true, @@ -18,6 +20,7 @@ "ApplicationDisabled": false, "Secret": "d6824d2fa32888931504", "Key": "c8b30f611ffb13202976", + "OnlySSL": false, "Name": "App 2", "AppID": "123", "UserEvents": true, diff --git a/ipe/config.go b/ipe/config.go index c12946c..974ff23 100644 --- a/ipe/config.go +++ b/ipe/config.go @@ -17,6 +17,7 @@ type configFile struct { // SSL Configurations Encrypted bool + SSLHost string SSLPrivateKey string SSLPublicKey string diff --git a/ipe/ipe.go b/ipe/ipe.go index 0bc6142..16b9720 100644 --- a/ipe/ipe.go +++ b/ipe/ipe.go @@ -32,7 +32,12 @@ func Start(configfile string) error { router := newRouter() if conf.Encrypted { - if err := http.ListenAndServeTLS(conf.Host, conf.SSLPublicKey, conf.SSLPrivateKey, router); err != nil { + go func () { + if err := http.ListenAndServe(conf.Host, router); err != nil { + return err + } + } + if err := http.ListenAndServeTLS(conf.SSLHost, conf.SSLPublicKey, conf.SSLPrivateKey, router); err != nil { return err } }else{