summaryrefslogtreecommitdiff
path: root/service/http/config.go
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2019-06-14 12:44:45 +0300
committerGitHub <[email protected]>2019-06-14 12:44:45 +0300
commit78724c084ac4db42e713c45ef8cb1453e8352183 (patch)
treea85abba72b65134a067f4f799b5e1d88a5101d3b /service/http/config.go
parent27e8cb3c4086012968b586fcbd5fd40737be2510 (diff)
parentac126193fb36fdf248336fa433cbd13602f2ae75 (diff)
Merge pull request #162 from ovr/fcgi
Feature - FastCGI support for HTTP Service
Diffstat (limited to 'service/http/config.go')
-rw-r--r--service/http/config.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/service/http/config.go b/service/http/config.go
index ecd5a3a8..4b5950b3 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -18,6 +18,8 @@ type Config struct {
// SSL defines https server options.
SSL SSLConfig
+ FCGI FCGIConfig
+
// MaxRequestSize specified max size for payload body in megabytes, set 0 to unlimited.
MaxRequestSize int64
@@ -32,6 +34,11 @@ type Config struct {
Workers *roadrunner.ServerConfig
}
+type FCGIConfig struct {
+ // Port and port to handle as http server.
+ Address string
+}
+
// SSLConfig defines https server configuration.
type SSLConfig struct {
// Port to listen as HTTPS server, defaults to 443.
@@ -47,11 +54,19 @@ type SSLConfig struct {
Cert string
}
+func (c *Config) EnableHTTP() bool {
+ return c.Address != ""
+}
+
// EnableTLS returns true if rr must listen TLS connections.
func (c *Config) EnableTLS() bool {
return c.SSL.Key != "" || c.SSL.Cert != ""
}
+func (c *Config) EnableFCGI() bool {
+ return c.FCGI.Address != ""
+}
+
// Hydrate must populate Config values using given Config source. Must return error if Config is not valid.
func (c *Config) Hydrate(cfg service.Config) error {
if c.Workers == nil {
@@ -146,7 +161,7 @@ func (c *Config) Valid() error {
return err
}
- if !strings.Contains(c.Address, ":") {
+ if c.Address != "" && !strings.Contains(c.Address, ":") {
return errors.New("mailformed http server address")
}