http-gateway/

directory
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2018 License: Apache-2.0

README

== HTTP Gateway
The *http gateway* accepts http requests posted to a `/messages/\{topic\}` endpoint, and trasforms those to messages emitted on the broker. Optionally, when posting to the `/requests/\{topic\}` endpoint, it waits for a reply correlated with the request on a dedicated internal topic, and marshalls that message as an http response.

== Whitelisting HTTP Request Headers

By default, the http-gateway filters out all HTTP request headers except for `Accept` and `Content-Type`.

The http-gateway can read a whitelist of headers from `RIFF_HTTP_HEADERS_WHITELIST`.

To configure this whitelist, you can update `config/deployment`, then run `make kubectl-apply`.

== Development
=== Prerequisites
The following tools are required to build this project:

- `make`
- Docker
- https://github.com/Masterminds/glide#install[Glide] for dependency management

If you intend to re-generate mocks for testing, install:

- https://github.com/vektra/mockery#installation[Mockery]

If you would like to run tests using the `ginkgo` command, install:

- http://onsi.github.io/ginkgo/[Ginkgo]

=== Get the source
[source, bash]
----
go get github.com/projectriff/riff
cd $(go env GOPATH)/github.com/projectriff/riff/http-gateway
----

=== Building
* To build locally (this will produce a binary named `http-gateway` on _your_ machine):
+
[source, bash]
----
make build
----

* To build for docker (and deploy as part of the whole https://github.com/projectriff/riff#-manual-install-of-riff[riff]
installation):
+
[source, bash]
----
make dockerize
----
This assumes that your docker client is correctly configured to target the daemon where you want the image built.

* To run tests:
+
[source, bash]
----
make test
----

* To attach a https://github.com/derekparker/delve/blob/master/Documentation/EditorIntegration.md[delve capable] debugger (such as Goland)
to an `http-gateway` running _inside_ k8s:
+
[source, bash]
----
make debug-dockerize
----
Then expose the `2345` port as a service, using `riff/config/delve/http-gateway-debug.yaml`:
+
[source, bash]
----
kubectl apply -f config/debug-service.yaml
----
After restarting the `http-gateway-...` pod, you can connect the debugger through `localhost:30100` (or `$(minikube ip):30100`).

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL