summaryrefslogtreecommitdiff
path: root/service/http/config.go
diff options
context:
space:
mode:
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")
}