Skip to content

Commit 831458e

Browse files
committed
fix(example): point OPA at the in-network NATS service name
The docker-compose example pointed OPA at nats://localhost:4222, but inside the OPA container `localhost` is the OPA container itself — not the NATS container. OPA therefore failed at startup with: Failed to connect to NATS: ... nats: no servers available for connection and exited before opening the HTTP server, which is why TestIntegration in CI got "context deadline exceeded" while waiting for /health. Use the docker-compose service name `nats` so OPA can reach NATS via the docker network. A comment notes the standalone (host) value.
1 parent a2dc5ea commit 831458e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

examples/opa-nats/config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
plugins:
22
nats:
3-
server_url: "nats://localhost:4222"
3+
# Inside the docker-compose stack OPA reaches NATS via the docker network
4+
# service name `nats`. If you run OPA outside docker (directly on the
5+
# host), set this to nats://localhost:4222 instead.
6+
server_url: "nats://nats:4222"
47
ttl: "10m"
58
refresh_interval: "30s"
69
max_reconnect_attempts: 10

0 commit comments

Comments
 (0)