dis-redirect-api
A Go API for management of redirects.
Getting started
Dependencies
- No further dependencies other than those defined in
go.mod
To run some of our tests you will need additional tooling:
Audit
We use dis-vulncheck to do Go auditing, which you will need to install.
For Java auditing we use mvn ossindex:audit which requires you to setup an OSS Index account
and make some updates to Maven: Local Setup for ossindex:audit
Component testing
To run the component tests, we use testcontainers via our dp-component-test library.
To get setup, follow our guidance on using testcontainers
If you're already setup, you will just need to ensure a docker daemon is running, for example via colima start.
Linting
We use v2 of golangci-lint, which you will need to install.
Validating Specification
To validate the swagger specification you can do this via:
make validate-specification
To run this, you will need to run Node > v20 and have redocly CLI installed:
npm install -g redocly-cli
Configuration
| Environment variable |
Default |
Description |
| BIND_ADDR |
:29900 |
The host and port to bind to |
| GRACEFUL_SHUTDOWN_TIMEOUT |
5s |
The graceful shutdown timeout in seconds (time.Duration format) |
| HEALTHCHECK_INTERVAL |
30s |
Time between self-healthchecks (time.Duration format) |
| HEALTHCHECK_CRITICAL_TIMEOUT |
90s |
Time to wait until an unhealthy dependent propagates its state to make this app unhealthy (time.Duration format) |
| OTEL_EXPORTER_OTLP_ENDPOINT |
localhost:4317 |
Endpoint for OpenTelemetry service |
| OTEL_SERVICE_NAME |
dis-redirect-api |
Label of service for OpenTelemetry service |
| OTEL_BATCH_TIMEOUT |
5s |
Timeout for OpenTelemetry |
| OTEL_ENABLED |
false |
Feature flag to enable OpenTelemetry |
| REDIRECT_API_URL |
localhost:29900 |
Currently used to populated HATEOS links |
| REDIS_ADDRESS |
localhost:6379 |
Endpoint for Redis service |
| REDIS_CLUSTER_NAME |
"" |
Cluster name for Redis service |
| REDIS_REGION |
"" |
AWS Region to connect to for Redis backing service |
| REDIS_SEC_PROTO |
"" |
Use 'TLS' to connect with TLS |
| REDIS_SERVICE |
"" |
Name of the redis service to connect to, e.g. memorydb, elasticache |
| REDIS_USERNAME |
"" |
Username to connect to Redis with |
SDKs
This API has two SDKs available:
Contributing
See CONTRIBUTING for details.
License
Copyright © 2025, Office for National Statistics (https://www.ons.gov.uk)
Released under MIT license, see LICENSE for details.