# Add-on Environment Variables

> Exact env vars exported by each add-on, and how aliases prefix them.

When you attach an add-on, Watasu injects connection details into your app as config vars. This page lists them per add-on. Read these like any other config var (`watasu config --app my-app`), but don't overwrite them — the add-on resets them on its next reconcile.

## PostgreSQL

| Variable       | Purpose                         |
| -------------- | ------------------------------- |
| `DATABASE_URL` | Full Postgres connection string |
| `PGHOST`       | Hostname                        |
| `PGPORT`       | Port                            |
| `PGDATABASE`   | Database name                   |
| `PGUSER`       | Username                        |
| `PGPASSWORD`   | Password                        |

`DATABASE_URL` is what most ORMs and frameworks read. The discrete `PG*` variables are for tools (`psql`, `pg_dump`) and code that builds connections programmatically.

## Valkey

| Variable         | Purpose                       |
| ---------------- | ----------------------------- |
| `REDIS_URL`      | Redis-protocol connection URL |
| `REDIS_HOST`     | Hostname                      |
| `REDIS_PORT`     | Port                          |
| `REDIS_PASSWORD` | Password                      |

The `REDIS_*` names are intentional — Valkey speaks the Redis protocol, and existing libraries that look for `REDIS_URL` work unchanged.

## ClickHouse

| Variable              | Purpose              |
| --------------------- | -------------------- |
| `CLICKHOUSE_URL`      | Full connection URL  |
| `CLICKHOUSE_HOST`     | Hostname             |
| `CLICKHOUSE_PORT`     | Native protocol port |
| `CLICKHOUSE_DATABASE` | Database name        |
| `CLICKHOUSE_USER`     | Username             |
| `CLICKHOUSE_PASSWORD` | Password             |

## Redpanda

Redpanda exports both `REDPANDA_*` and `KAFKA_*` names so Kafka client libraries find what they expect:

| Variable                                                       | Purpose             |
| -------------------------------------------------------------- | ------------------- |
| `REDPANDA_BROKERS`, `KAFKA_BROKERS`, `KAFKA_BOOTSTRAP_SERVERS` | Broker address list |
| `REDPANDA_USERNAME`, `KAFKA_USERNAME`                          | SASL username       |
| `REDPANDA_PASSWORD`, `KAFKA_PASSWORD`                          | SASL password       |

## Object Storage

Object storage exports a wide set of S3-compatible variables so that whichever name your SDK looks for, it finds:

| Variable                                                         | Purpose                                                                    |
| ---------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `S3_BUCKET`, `AWS_S3_BUCKET`                                     | Bucket name                                                                |
| `S3_ACCESS_KEY_ID`, `AWS_ACCESS_KEY_ID`                          | Credential ID                                                              |
| `S3_SECRET_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY`                  | Credential secret                                                          |
| `S3_ENDPOINT`, `AWS_ENDPOINT_URL`, `AWS_ENDPOINT_URL_S3`         | Endpoint (this isn't AWS — it's the Watasu-managed S3-compatible endpoint) |
| `S3_REGION`, `AWS_REGION`, `AWS_DEFAULT_REGION`, `AWS_S3_REGION` | Region label expected by AWS SDKs                                          |
| `S3_FORCE_PATH_STYLE`                                            | Whether the SDK should use path-style addressing                           |
| `S3_PUBLIC_BUCKET_URL`, `AWS_S3_URL`                             | Convenience URLs combining bucket + endpoint                               |

Most SDKs (`boto3`, `aws-sdk-*`, `rclone`, `minio`, etc.) pick these up automatically.

## Metrics

| Variable                              | Purpose                                                           |
| ------------------------------------- | ----------------------------------------------------------------- |
| `METRICS_PORT`                        | Port your app should serve Prometheus metrics on (default `9464`) |
| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | OTLP metrics push endpoint                                        |
| `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` | `http/protobuf`                                                   |
| `PROMETHEUS_REMOTE_WRITE_URL`         | Prometheus remote-write endpoint                                  |

Serve your metrics endpoint on `$METRICS_PORT` and Watasu scrapes it — see [Metrics](https://docs.watasu.io/observability/metrics.md).

## Traces

| Variable                             | Purpose                                      |
| ------------------------------------ | -------------------------------------------- |
| `OTEL_EXPORTER_OTLP_ENDPOINT`        | OTLP ingest endpoint                         |
| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | The same endpoint with the `/v1/traces` path |
| `OTEL_EXPORTER_OTLP_PROTOCOL`        | `http/protobuf`                              |

Standard OpenTelemetry SDKs read these automatically.

## Logs and Grafana

The logs and Grafana add-ons collect from the platform side and don't inject any env vars into your app.

## Aliases

When you attach an add-on with `--as <ALIAS>`, every variable that add-on would normally export gets prefixed with `ALIAS_`:

```bash
watasu addons:attach reporting-db --app my-app --as REPORTING
```

Now your app sees both:

* `DATABASE_URL` — the original primary
* `REPORTING_DATABASE_URL` — the new alias

This is how you give one app multiple databases of the same kind, and it's how PostgreSQL CLI commands target a specific database (`watasu pg:psql REPORTING_DATABASE_URL`, or just `watasu pg:psql reporting`).

## Qdrant

For [Qdrant](https://docs.watasu.io/addons/qdrant.md), attachments supply `QDRANT_URL`, `QDRANT_GRPC_URL`, `QDRANT_API_KEY`, `QDRANT_READ_ONLY_API_KEY`, and the PEM `QDRANT_CA_CERT`. Private clients must trust the supplied CA. Aliases prefix these names as for other services.

[View this page on the web](https://docs.watasu.io/reference/addon-env-vars/)
