Skip to content

Conversation

domsj
Copy link

@domsj domsj commented Dec 1, 2021

Hi,

In our use case we configure pgweb to connect with a given database by setting DATABASE_URL in the environment.
This saves the end user the trouble of entering connection details in the UI.

After a while however it is possible that the connection to the database breaks, causing the UI to prompt for connection details.
Ideally this would not be needed since this pgweb instance is only meant to be used for a single database, for which connection details are available in the environment.

This PR introduces a change that allows automatically reconnecting in such cases.

remarks:

  • I think that ideally the connect/disconnect buttons would get hidden if e.g. DATABASE_URL was configured, since this means we just want to run this pgweb for a single database - I haven't gone this far in this PR
  • with this patch the user can disconnect (resulting in the connect screen being shown to them). if they next refresh the page they are again connected - this might be unexpected. (but no functionality is lost to them)

Would you be interested in this change, or is there anything I can do to make it (more) acceptable?

@sosedoff
Copy link
Owner

sosedoff commented Dec 19, 2022

  1. The reconnect screen appearing is a legit issue, and i've stumbled upon it quite a few times, mostly in the environments where pgweb runs on the same host as the database, and database gets restarted periodically. Page reload would fix the connection, however any user that's not aware of reconnect functionality will be confused on what to do next.

  2. As for disabling connect/disconnect features, IMO you can use --lock-session CLI option which will disallow connect/disconnect features beyond the initial one that pgweb makes during the startup.

I've reworked the flow for pt. 1 in #623 that should fix the reconnect flow for 99% of the users.

@sosedoff sosedoff closed this Dec 19, 2022
@domsj domsj deleted the reconnect branch December 20, 2022 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants