cli icon indicating copy to clipboard operation
cli copied to clipboard

environment variable for postgres hostname, removing hardcoded 'localhost'

Open ryanalta opened this issue 3 years ago • 0 comments

Bug report

Describe the bug

The database connection string for the command supabase db reset appears to include a hardcoded 'localhost' for the hostname, and I am not finding anywhere I can override this.

I'm not really great at go or familiar with the project but searching the codebase for 'localhost' seems to reveal hardcoded connection strings with no environment variable option in a couple spots.

https://github.com/supabase/cli/blob/aa6a5121cbc52201a31d6308d987cebd34e46aad/internal/db/reset/reset.go#L54

To Reproduce

Using a VSCode dev container, I install the supabase cli, init and start a database (no problems), and then run supabase db reset

Expected behavior

Able to set a postgres connection string or minimally, host so that supabase db reset runs.

Current result:

# supabase db reset
Resetting database...
Initialising schema...
Error: failed to connect to `host=localhost user=postgres database=main`: dial error (dial tcp [::1]:54322: connect: cannot assign requested address)

System information

  • OS: linux, docker container
  • Version of supabase-cli: 1.5.0

ryanalta avatar Sep 27 '22 22:09 ryanalta