- Introduced AggregateConfig to manage aggregation settings in the gateway configuration. - Added validation for reserved alias 'agg' and included tests for aggregate alias handling. - Updated config.example.yaml to demonstrate aggregate configuration options. - Enhanced README.md to include information about the new aggregation endpoint and its usage. - Modified gateway.go to integrate the new aggregate handler for processing aggregation requests.
50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
# Telemt API gateway — copy to config.yaml and mount into the container.
|
|
#
|
|
# Semantics: client calls GET /api/{alias}/health
|
|
# forwarded to GET {base_url}/v1/health
|
|
|
|
listen: ":8080"
|
|
|
|
# If true, IP whitelist is not enforced (development only).
|
|
allow_all: false
|
|
|
|
# CIDR allowlist when allow_all is false. Empty list denies all clients.
|
|
# Можно указывать и одиночный IP (будет трактован как /32 или /128), и CIDR.
|
|
whitelist_cidrs:
|
|
- "127.0.0.1/32"
|
|
- "203.0.113.5"
|
|
- "::1/128"
|
|
# Docker bridge (adjust to your environment):
|
|
# - "172.16.0.0/12"
|
|
|
|
# When the direct TCP peer is in these CIDRs, client IP for whitelist is taken
|
|
# from X-Forwarded-For (first hop) or X-Real-IP (e.g. behind nginx).
|
|
# trusted_proxies:
|
|
# - "10.0.0.0/8"
|
|
trusted_proxies: []
|
|
|
|
# Опционально: по умолчанию /api/agg/* опрашивает все servers; можно ограничить список:
|
|
# aggregate:
|
|
# include_aliases:
|
|
# - gt1
|
|
# - gt2
|
|
|
|
servers:
|
|
- alias: main_srv
|
|
base_url: http://127.0.0.1:9091
|
|
path_prefix: /v1
|
|
# authorization_env: TELEMT_API_AUTH
|
|
|
|
# ivx: HTTPS + nginx location /api/ → Telemt; base_url должен заканчиваться на /api/
|
|
- alias: gt1
|
|
base_url: https://gt1.ivx.su/api/
|
|
path_prefix: /v1
|
|
|
|
- alias: gt2
|
|
base_url: https://gt2.ivx.su/api/
|
|
path_prefix: /v1
|
|
|
|
- alias: gt3
|
|
base_url: https://gt3.ivx.su/api/
|
|
path_prefix: /v1
|