Go to file
2021-11-15 16:03:59 +01:00
.github/workflows * optimize logging 2021-10-05 12:25:03 +02:00
bin * refactor service base on keel 2021-10-03 09:45:15 +02:00
cmd/contentfulproxy style: format code 2021-11-15 15:42:36 +01:00
packages/go style: fix lint errors 2021-11-15 16:03:59 +01:00
proxy style: fix lint errors 2021-11-15 16:03:59 +01:00
.editorconfig chore: update git ignore 2021-11-15 15:45:49 +01:00
.gitignore chore: update git ignore 2021-11-15 15:45:49 +01:00
.golangci.yml style: fix lint errors 2021-11-15 16:03:59 +01:00
.goreleaser.yml style: fix lint errors 2021-11-15 16:03:59 +01:00
Dockerfile * optimize logging 2021-10-05 12:25:03 +02:00
go.mod * optimize logging 2021-10-05 12:25:03 +02:00
go.sum * optimize logging 2021-10-05 12:25:03 +02:00
LICENSE Initial commit 2021-09-27 11:27:39 +02:00
Makefile * optimize logging 2021-10-05 12:25:03 +02:00
README.md * add some basic documentation in a Readme 2021-10-05 13:01:26 +02:00

contentfulproxy

An experimental reverse proxy cache for the contentful API. Point your contentful client to the proxy instead of the contenful API endpoints (cdn.contentful.com or preview.contentful.com) and the proxy will cache the API-responses and return them.

Configuration

# environment variables
WEBHOOK_URLS        // comma-separated list of URLs called after a cache update
WEBSERVER_PATH      // set this if the service is running in a subdirectory
BACKEND_URL	    // the contentful api you want to use
WEBSERVER_ADDRESS   // address and port the service should listen to

Usages

Use as library

logger := zap.New(...)
webhookURLs := func()[]string{ return []string{} }
webserverPath := func()string{ return "/proxy/exposed/on/path" }
backendURL := func()string{ return "https://cdn.contentful.com" }

proxy, _ := proxy.NewProxy(
	context.Background(),
	logger,
	backendURL,
	webserverPath,
	webhookURLs,
)

http.ListenAndServe(":80", proxy)

Run in docker

$ docker run -p 8080:80 -e WEBHOOK_URLS=https://my-service/webhook1,https://my-service/webhook2 foomo/contentfulproxy

Use as service in a squadron

version: '1.0'
name: my-squadron
squadron:
	contentfulproxy:
		chart: /path/to/helm/chart
		values:
			image:
				tag: 0.0.1
				repository: foomo/contentfulproxy
			ports:
				- 80
			env:
				WEBHOOK_URLS: https://my-service/webhook1,https://my-service/webhook2
				WEBSERVER_PATH: /proxy/exposed/on/path
				BACKEND_URL: https://cdn.contentful.com
			ingress:
				paths:
					- path: /proxy/exposed/on/path
						port: 80

License

Copyright (c) foomo under the LGPL 3.0 license.