summaryrefslogtreecommitdiff
path: root/plugins/http/config/http.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-22 11:04:09 +0300
committerGitHub <[email protected]>2021-01-22 11:04:09 +0300
commit29d6020a9e8a3713b22269ed946547c96c24d3da (patch)
treeafe4d330ecb4180e1a9970c8e250bf4f8d92c15e /plugins/http/config/http.go
parent6807441b2bf1e821e335d67567af47567c9757f3 (diff)
parent4d60db85d1c0bfeddffe1de3e28d3464949c5f6d (diff)
Merge pull request #494 from spiral/feature/allow_https_listen_on_unix_socketsv2.0.0-beta11
feat(https): Allow https to listen on unix sockets
Diffstat (limited to 'plugins/http/config/http.go')
-rw-r--r--plugins/http/config/http.go34
1 files changed, 6 insertions, 28 deletions
diff --git a/plugins/http/config/http.go b/plugins/http/config/http.go
index 76547fde..bd689918 100644
--- a/plugins/http/config/http.go
+++ b/plugins/http/config/http.go
@@ -2,7 +2,6 @@ package config
import (
"net"
- "os"
"runtime"
"strings"
"time"
@@ -13,7 +12,7 @@ import (
// HTTP configures RoadRunner HTTP server.
type HTTP struct {
- // Port and port to handle as http server.
+ // Host and port to handle as http server.
Address string
// SSLConfig defines https server options.
@@ -97,8 +96,8 @@ func (c *HTTP) InitDefaults() error {
c.SSLConfig = &SSL{}
}
- if c.SSLConfig.Port == 0 {
- c.SSLConfig.Port = 443
+ if c.SSLConfig.Address == "" {
+ c.SSLConfig.Address = ":443"
}
err := c.HTTP2Config.InitDefaults()
@@ -191,30 +190,9 @@ func (c *HTTP) Valid() error {
}
if c.EnableTLS() {
- if _, err := os.Stat(c.SSLConfig.Key); err != nil {
- if os.IsNotExist(err) {
- return errors.E(op, errors.Errorf("key file '%s' does not exists", c.SSLConfig.Key))
- }
-
- return err
- }
-
- if _, err := os.Stat(c.SSLConfig.Cert); err != nil {
- if os.IsNotExist(err) {
- return errors.E(op, errors.Errorf("cert file '%s' does not exists", c.SSLConfig.Cert))
- }
-
- return err
- }
-
- // RootCA is optional, but if provided - check it
- if c.SSLConfig.RootCA != "" {
- if _, err := os.Stat(c.SSLConfig.RootCA); err != nil {
- if os.IsNotExist(err) {
- return errors.E(op, errors.Errorf("root ca path provided, but path '%s' does not exists", c.SSLConfig.RootCA))
- }
- return err
- }
+ err := c.SSLConfig.Valid()
+ if err != nil {
+ return errors.E(op, err)
}
}