dbeaver / cloudbeaver

Cloud Database Manager
https://dbeaver.com/
Apache License 2.0
3.39k stars 370 forks source link

Allow preconfiguring connection type value in data-sources.json (e.g. PostgreSQL Passfile) and/or document how to do this #2911

Open webketje opened 1 week ago

webketje commented 1 week ago

Is your feature request related to a problem? Please describe. It looks like it's currently not possible to preconfigure a connection to use a .pgpass file. The use case is a Dockerfile extending dbeaver/cloudbeaver:latest, setting ENV PGPASSFILE='/opt/cloudbeaver/conf/pgpass.conf', intended to be deployed on Openshift (using volume mounts and/or docker run --env and/or docker build --build-arg args)

Describe the solution you'd like I would like to be able to preconfigure the value "PostGreSQL Passfile" in the dropdown in the screenshot below as part of the data-sources.json connection spec. It already allows host, port, user, if it had a connectionType it could easily match a .pgpass file line with the rest of the connection's parameters. If this solution does exist, please make it easier to find in the docs? I've searched them for about an hour. image

Currently this is the only obstacle standing in the way of a fully automated containerized DB GUI solution. Another acceptable solution would be a way to pre-generate the credentials-config.json

LonwoLonwo commented 1 week ago

Hello @webketje

I am confused about your authentication screen. Did you try to use the PostgreSQL PgPass authentication type? Why do you use pgpass + database native type?

2024-09-12 11_10_56-CloudBeaver Community — Mozilla Firefox

webketje commented 1 week ago

@LonwoLonwo The screenshot just indicates the location of the field that I wish to show "PostgreSQL PgPass" by default, the first time it is opened. In the context of a Docker container, you don't want to have to do post-deploy configuration in the dashboard, my request is to pre-set this value programmatically via env vars/ config at the server-side.

I've searched some more and found: https://dbeaver.com/docs/dbeaver/Database-authentication-models/#pgpass, which mentions the model ID of the value (I think) postgres_pgpass. However, https://dbeaver.com/docs/cloudbeaver/Create-Connection/#use-the-pre-configured-connections only mentions data-sources.json briefly and it is not explained anywhere which "model ID's" map to the fields in the Create connection UI.

So I created a connection via the UI, then went into the container to see how the values were updated. What I believe I am looking for is:

{
  "connections": {
    "postgres-1": {
        "auth-model": "postgres_pgpass",
        ...otherProperties
      }
   }
}

Haven't tested yet, but just as much in the dark as to where Cloudbeaver will look for the pgpass file... Does it take into account the PGPASSFILE env var? PS: this is not only about PGSQL, this is about a lack of clarity on how to preconfigure /opt/cloudbeaver/workspace/GlobalConfiguration/.dbeaver/data-sources.json