pgadmin4
pgadmin4 copied to clipboard
Programmatically updating servers from without overwriting them
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!
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).
Is there another way to update an existing server programmatically?
Apart from GUI, there is no other way to do it now.
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?
Related:
- #3790