Skip to content

postgres sslmode not respected when using environment variable connection string #260

Closed

Description

@danielmklein

Hi there!

We are using Refinery via the CLI, a la refinery migrate -e DATABASE_URL -p ./migrations.

We really want to require SSL connections to our Postgres database, but Refinery is proving problematic for that. When DATABASE_URL is of the form postgres://my_user:[email protected]:5432/db_name?sslmode=require, it does not appear that the sslmode param is respected.

When the relevant database is configured to require SSL, we see an error of the form 0: db error: FATAL: no pg_hba.conf entry for host "x.x.x.x", user "my_user", database "db_name", no encryption, indicating that Refinery is not actually using SSL for the connection.

Please let me know if there is more info I can provide to help debugging this!

Activity

  1. changed the title [-]postgres sslmode=require not respected when using environment variable connection string[/-] [+]postgres sslmode not respected when using environment variable connection string[/+] on Dec 2, 2022
  2. jxs commented on Dec 10, 2022

    @jxs
    Member

    Hi, and thanks for the interest! This seems akin to #258. Would you like to submit a PR addressing this? I think it's just a matter of adding the query params to Config, see here, and then forward them again on the build_db_url, see here

  3. freezing commented on Jun 5, 2025

    @freezing

    Hi, what's the status here? It seems that #353 fixes it but it was never released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions