pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Programmatically updating servers from without overwriting them

Open maxnitze opened this issue 10 months ago • 5 comments

I installed pgadmin in Kubernetes and added a sidecar to auto-import servers created as configmaps in the pgadmin namespace (using https://github.com/kiwigrid/k8s-sidecar).

To get the servers into pgadmin I compile them all into one servers.json (making sure they are all Shared) and call setup.py load-servers --replace servers.json in the main pgadmin container with the admin user.

This works quite well in general. All servers are created, updated and deleted from the list for all users (the users login with Keycloak/Oauth2).

BUT: Every time something changed (server was added, changed, deleted) and the load-servers command ran, the saved passwords of all users are gone. My guess is, that the --replace deletes the reference somehow.

I already tried to use stable keys in the servers.json and removing the --replace hpoing, that this will update the existing entries. But it seems to just add new entries then.

Is there the possibility to update all servers without loosing the saved passwords for all users?

Thanks in advance!

maxnitze avatar Apr 25 '24 09:04 maxnitze

Hi @maxnitze,

That's the behaviour of the feature; --replace removes the old server entries and adds them again. We can think of an enhancement that will update the existing servers on some mapping ( which needs to be identified).

khushboovashi avatar Apr 25 '24 09:04 khushboovashi

Is there another way to update an existing server programmatically?

maxnitze avatar Apr 25 '24 10:04 maxnitze

Apart from GUI, there is no other way to do it now.

khushboovashi avatar Apr 25 '24 10:04 khushboovashi

Okay. So from my perspective there are multiple ways to solve my specific problem:

  • provide an API to update existing servers
  • update exiwting servers in replace mode (based on connection string?)
  • bind saved passwords to connection strings instead of servers (security implications?)

What do you think?

maxnitze avatar Apr 25 '24 10:04 maxnitze

Related:

  • #3790

cbandy avatar Apr 26 '24 13:04 cbandy