pmorie / osb-broker-lib

A go library for developing an Open Service Broker
Apache License 2.0
28 stars 23 forks source link

Allow to register APISurface endpoints and handlers on an external HTTP server #32

Closed clamoriniere1A closed 6 years ago

clamoriniere1A commented 6 years ago

Currently, it isn't possible to register the Broker APISurface handlers on an external HTTP server, since the registration was included in the server.New(...) method that instantiates also the server.Server (https://github.com/pmorie/osb-broker-lib/blob/master/pkg/server/server.go#L30)

In some case, we may want to use the "osb-broker-lib" in an existing process like an "Operator". Also, this existing process may have already an HTTP server running (maybe with an existing Prometheus endpoint already registered...). And so, It will be useful to register only the APISurface endpoints and handler on the existing HTTP server, instead of having a second HTTP server only for the Broker part.

clamoriniere1A commented 6 years ago

I did the modification that allows retrieving the broker endpoints and handlers configuration behind an http.Handler interface: https://github.com/clamoriniere1A/osb-broker-lib/blob/feature/externallHTTPServer/pkg/server/server.go#L30 Let me know if this approach is fine for you.

n3wscott commented 6 years ago

Looks good to me, I suggest making a PR for this back into pmorie/osb-broker-lib. It is backwards compatible and only opens up the options for adopters. Nice work @clamoriniere1A