Goma HTTP Provider is an HTTP server that serves Goma Gateway configurations from multiple dir
2.2K
The Goma HTTP Provider is a centralized configuration service designed for Goma Gateway deployments. It allows multiple gateway instances to dynamically fetch their configuration over HTTP, based on authentication and request metadata.
By separating configuration delivery from gateway runtime, Goma HTTP Provider makes it easy to manage environment-specific configurations (production, staging, development, etc.) from a single control plane.
Multi-directory configuration support Serve configurations from different directories mapped to environments.
Metadata-based environment resolution Automatically select the appropriate configuration using request headers.
Multiple authentication methods
Optional default configuration Allow unauthenticated access when no metadata or auth is required.
Docker-ready Easily deploy using Docker or container orchestration platforms.
Built-in OpenAPI / Swagger documentation Explore and test the API interactively.
⚠️ Even if authentication succeeds, metadata must match the configuration definition for access to be granted (unless the configuration is marked as
default).
Goma HTTP Provider supports flexible access control using one or more of the following:
Authentication and metadata checks can be combined to ensure that only authorized gateways can retrieve the correct configuration for their environment.
Metadata is used to select the appropriate configuration.
If a configuration defines the metadata key environment, the incoming HTTP request must include the corresponding header:
X-Goma-Meta-Environment: production
X-Goma-Meta-defaultThe Goma HTTP Provider exposes the following HTTP endpoints:
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/config | Retrieve the gateway configuration based on request metadata and authentication |
POST | /api/v1/config/reload | Reload the configuration for the matching environment (based on metadata) |
GET | /api/v1/config/stats | Get statistics for the selected configuration |
GET | /healthz | Health check endpoint |
All /api/v1/config* endpoints:
default)X-Goma-Meta-*)The following environment variables can be used to configure the Goma HTTP Provider:
| Variable | Description | Default |
|---|---|---|
PORT | Port the HTTP server listens on | 8080 |
ENABLE_DOCS | Enable or disable the Swagger / OpenAPI documentation | true |
TLS_CERT_PATH | Path to the TLS certificate file (PEM format) | disabled |
TLS_KEY_PATH | Path to the TLS private key file (PEM format) | disabled |
By default, the server runs on port 8080.
You can override it using the PORT environment variable:
export PORT=9000
CLI flags (e.g.
--port) typically take precedence over environment variables, if both are set.
To enable HTTPS, both TLS_CERT_PATH and TLS_KEY_PATH must be set:
export TLS_CERT_PATH=/etc/ssl/certs/server.crt
export TLS_KEY_PATH=/etc/ssl/private/server.key
If one of the values is missing, the server falls back to HTTP.
The OpenAPI specification is automatically generated from the application configuration.
Swagger UI is enabled by default. To disable it:
export ENABLE_DOCS=false
# Clone the repository
git clone https://github.com/jkaninda/goma-http-provider
cd goma-http-provider
# Install dependencies
go mod tidy
# Run the application
go run . --config data/config.yaml
Default port: 8080
Override port:
go run . --config data/config.yaml --port 9000
http://localhost:8080http://localhost:8080/docsdocker run --rm --name goma-http-provider \
-p 8080:8080 \
-v ./data:/data \
jkaninda/goma-http-provider \
--config /data/config.yaml
configurations:
- directory: ./data/configs/production
default: false
metadata:
environment: production
region: eu-central-bg1
gateway-id: goma-prod-01
auth:
basicAuth:
username: admin
password: "change me"
- directory: ./data/configs/staging
metadata:
environment: staging
region: eu-central-fsn1
gateway-id: goma-stage-01
auth:
basicAuth:
username: admin
password: staging-pass
- directory: ./data/configs/development
default: true
metadata:
environment: dev
region: eu-central-fsn1
gateway-id: goma-dev-01
auth: {} # No authentication required
# auth:
# apiKey: dev-secret-key-123
When default: true:
Only one configuration should be marked as default
gateway:
providers:
http:
enabled: true
endpoint: "https://config.example.com/api/v1/config"
interval: 60s
timeout: 10s
retryAttempts: 5
retryDelay: 3s
cacheDir: "" # Defaults to /tmp/goma/cache/config.json
insecureSkipVerify: false
headers:
X-Goma-Meta-Gateway-Id: goma-prod-01
X-Goma-Meta-Region: eu-central-bg1
X-Goma-Meta-Environment: production
Authorization: "${GOMA_PROD_AUTHORIZATION}"
# X-API-Key: xxxxxx-xxxxx-xxxx
MIT — Free to use, modify, and distribute.
Copyright (c) 2026 Jonas Kaninda
Content type
Image
Digest
sha256:8c2580839…
Size
14.6 MB
Last updated
8 months ago
docker pull jkaninda/goma-http-provider