$PGHOST & $PGPORT are not respected.
- Langage dominant
- Go
- Étoiles
- 7.4k
- Forks
- 379
- Merge moyen
- 6 min
- PR mergées (30 j)
- 1
Description
Given the following environment variables:
- `$DATABASE_URL`: `postgres://`
- `$PGHOST`: `some-host`
- `$PGPORT`: `8888`
- `$PGDATABASE`: `some-db`
I believe it'd be a logical assumption, for callers of `dbmate`, to expect that (`dbmate`) would attempt, in any such case, to connect to `some-db`, via dialing `some-host` on port `8888`, while retaining `postgres://` as the value of its `url.URL`.
However, what happens instead is that `dbmate` tries to connect via `/var/run/postgresql/.s.PGSQL.5432` (or the equivalent platform default, as defined in [`connectionString`](https://github.com/amacneil/dbmate/blob/26dd5ea397d7e4aa7da960805cf59023b82f313e/pkg/driver/postgres/postgres.go#L39C1-L39C1)), disregarding any [Postgres-related environment variable](https://www.postgresql.org/docs/current/libpq-envars.html) that may be defined in its environment, and replaces the empty tokens (`host`, `port`, etc) with hard-coded values.
I believe that `lib/pg`, the underlying driver, supports these environment variables when considering each connection string / DSN.
Is this behavior intended? If not, happy to take a stab at a patch for it.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.