- File
-
rack_monkey_patch.rb
- (C)
-
Loyalty New Zealand 2014
- Purpose
-
Heyre Be Dragyns.
For local development, the service middleware needs to know where other resource endpoints are in terms of HTTP host and port, so that remote inter-resource calls can work without up-front static configuration of service host/port data. To have to manage a fixed list of local development ports in the face of arbitrary resource endpoint divisions would be a big pain and cause developers much frustration.
This means that whenever a service starts up, it needs to know the HTTP host and port under which it is running, then tell the middleware about it.
In the absence of a formal interface in Rack for this, then we could do still that relatively nicely by looking up the Rack server in ObjectSpace and asking it for its options - except some of the web server adapters do really dumb things like “options.delete(:Host)” to read items out, destroying the info we need.
So instead, we have to monkey patch :-(
11-Nov-2014 (ADH): Split out from service_middleware.rb.
- MODULE Hoodoo
- MODULE Hoodoo::Services
- MODULE Rack
- CLASS Rack::Server