Skip to content

Commit

Permalink
Sockets: fix config SSL JSON parsing in Go workers
Browse files Browse the repository at this point in the history
  • Loading branch information
Morfent committed Jun 12, 2017
1 parent a67063e commit 9f7b077
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
20 changes: 10 additions & 10 deletions sockets/lib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9f7b077

Please sign in to comment.