Both server running. SSL and Non SSL
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -17,6 +17,7 @@ type configFile struct {
|
||||
|
||||
// SSL Configurations
|
||||
Encrypted bool
|
||||
SSLHost string
|
||||
SSLPrivateKey string
|
||||
SSLPublicKey string
|
||||
|
||||
|
||||
+6
-1
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user