https://github.com/foomo/contentfulproxy
an experimental proxy for read access to contentful to save your API quota
https://github.com/foomo/contentfulproxy
contentful foomo-contentfulproxy
Last synced: 2 months ago
JSON representation
an experimental proxy for read access to contentful to save your API quota
- Host: GitHub
- URL: https://github.com/foomo/contentfulproxy
- Owner: foomo
- License: mit
- Created: 2021-09-27T09:27:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-07T21:19:40.000Z (5 months ago)
- Last Synced: 2025-01-12T15:46:05.183Z (4 months ago)
- Topics: contentful, foomo-contentfulproxy
- Language: Go
- Homepage: https://www.foomo.org
- Size: 340 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://github.com/foomo/contentfulproxy/actions/workflows/test.yml)
[](https://goreportcard.com/report/github.com/foomo/contentfulproxy)
[](https://coveralls.io/github/foomo/contentfulproxy?branch=main)
[](https://godoc.org/github.com/foomo/contentfulproxy)
![]()
# 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
```bash
# 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
```go
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
```bash
$ docker run -p 8080:80 -e WEBHOOK_URLS=https://my-service/webhook1,https://my-service/webhook2 foomo/contentfulproxy
```### Use as service in a squadron
```yaml
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
```## How to Contribute
Make a pull request...
## License
Distributed under MIT License, please see license file within the code for more details.
_Made with ♥ [foomo](https://www.foomo.org) by [bestbytes](https://www.bestbytes.com)_