summaryrefslogtreecommitdiff
path: root/service/http/config.go
diff options
context:
space:
mode:
authorDmitry Patsura <[email protected]>2019-06-20 13:08:34 +0300
committerDmitry Patsura <[email protected]>2019-06-20 13:08:34 +0300
commitfddaca06c683654cb86934f38681c30188acbbf5 (patch)
tree64b7bfc36f9e49a45473fae33744975b977d26f4 /service/http/config.go
parent85126b000d140efdd99573e44241ee1e8b84d3c5 (diff)
Feature(http): Introduce support for customResponseHeaders/customRequestHeaders by headers middleware
Diffstat (limited to 'service/http/config.go')
-rw-r--r--service/http/config.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/service/http/config.go b/service/http/config.go
index 5454f124..2b8cf049 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -33,10 +33,26 @@ type Config struct {
// HTTP2 configuration
HTTP2 *HTTP2Config
+ // Middlewares
+ Middlewares *MiddlewaresConfig
+
// Workers configures rr server and worker pool.
Workers *roadrunner.ServerConfig
}
+type MiddlewaresConfig struct {
+ Headers *HeaderMiddlewareConfig
+}
+
+type HeaderMiddlewareConfig struct {
+ CustomRequestHeaders map[string]string
+ CustomResponseHeaders map[string]string
+}
+
+func (c *MiddlewaresConfig) EnableHeaders() bool {
+ return c.Headers.CustomRequestHeaders != nil || c.Headers.CustomResponseHeaders != nil
+}
+
type FCGIConfig struct {
// Port and port to handle as http server.
Address string
@@ -73,6 +89,10 @@ func (c *Config) EnableHTTP() bool {
return c.Address != ""
}
+func (c *Config) EnableMiddlewares() bool {
+ return c.Middlewares != nil
+}
+
// EnableTLS returns true if rr must listen TLS connections.
func (c *Config) EnableTLS() bool {
return c.SSL.Key != "" || c.SSL.Cert != ""