From 9f7b07740d41cba4d08cd986db6a03569a5e0acf Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Sun, 11 Jun 2017 19:33:12 -0300 Subject: [PATCH] Sockets: fix config SSL JSON parsing in Go workers --- sockets.js | 2 +- sockets/lib/config.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sockets.js b/sockets.js index 8e8b795238701..f50d4eb301b54 100644 --- a/sockets.js +++ b/sockets.js @@ -341,7 +341,7 @@ class GoWorker extends EventEmitter { workers: Config.workers || 1, port: `:${Config.port || 8000}`, bindAddress: Config.bindaddress || '0.0.0.0', - ssl: Config.ssl || null, + ssl: Config.ssl ? Object.assign({}, Config.ssl, {port: `:${Config.ssl.port}`}) : null, }), }, stdio: ['inherit', 'inherit', 'pipe'], diff --git a/sockets/lib/config.go b/sockets/lib/config.go index c35e326bf13a1..98aaa7795bddf 100644 --- a/sockets/lib/config.go +++ b/sockets/lib/config.go @@ -14,21 +14,21 @@ import ( "os" ) -type config struct { - Workers int `json:"workers"` // Number of workers for the master to spawn. - Port string `json:"port"` // HTTP server port. - BindAddress string `json:"bindAddress"` // HTTP/HTTPS server(s) hostname. - SSL sslOpts `json:"ssl"` // HTTPS config settings. +type sslcert struct { + Cert string `json:"cert"` // Path to the SSL certificate. + Key string `json:"key"` // Path to the SSL key. } -type sslOpts struct { +type sslconf struct { Port string `json:"port"` // HTTPS server port. - Options sslKeys `json:"options"` // SSL config settings. + Options sslcert `json:"options"` // SSL config settings. } -type sslKeys struct { - Cert string `json:"cert"` // Path to the SSL certificate. - Key string `json:"key"` // Path to the SSL key. +type config struct { + Workers uint8 `json:"workers"` // Number of workers for the master to spawn. + Port string `json:"port"` // HTTP server port. + BindAddress string `json:"bindAddress"` // HTTP/HTTPS server(s) hostname. + SSL sslconf `json:"ssl,omitempty"` // HTTPS config settings. } func NewConfig(envVar string) (c config, err error) {