summaryrefslogtreecommitdiff
path: root/service/http
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2019-12-23 12:04:12 +0300
committerGitHub <[email protected]>2019-12-23 12:04:12 +0300
commit7f694966730f6dac09d0d0ea3bf51276b8e4dfe4 (patch)
tree55d584785e87aef8ee15f5ab5f01c22d50754397 /service/http
parentfadf373c1fe5e51bfaeb9e5ac3fe4ee748620a44 (diff)
parent028ff585f8f8a42f4796afdb932f97eee6eb8f4c (diff)
Merge pull request #204 from spiral/feature/hotreload
[wip] Hot-reloading capabilities - review wanted
Diffstat (limited to 'service/http')
-rw-r--r--service/http/service.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/service/http/service.go b/service/http/service.go
index 58038acb..945a12c4 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -31,6 +31,7 @@ type middleware func(f http.HandlerFunc) http.HandlerFunc
// Service manages rr, http servers.
type Service struct {
cfg *Config
+ cprod roadrunner.CommandProducer
env env.Environment
lsns []func(event int, ctx interface{})
mdwr []middleware
@@ -48,6 +49,11 @@ func (s *Service) Attach(w roadrunner.Controller) {
s.controller = w
}
+// ProduceCommands changes the default command generator method
+func (s *Service) ProduceCommands(producer roadrunner.CommandProducer) {
+ s.cprod = producer
+}
+
// AddMiddleware adds new net/http mdwr.
func (s *Service) AddMiddleware(m middleware) {
s.mdwr = append(s.mdwr, m)
@@ -87,6 +93,7 @@ func (s *Service) Serve() error {
}
}
+ s.cfg.Workers.CommandProducer = s.cprod
s.cfg.Workers.SetEnv("RR_HTTP", "true")
s.rr = roadrunner.NewServer(s.cfg.Workers)