RE: [Pgadmin] [Docker] servers.json import fails when running in desktop mode

From: Levitt Olivier <olivier(dot)levitt(at)insee(dot)fr>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: "pgadmin-hackers(at)postgresql(dot)org" <pgadmin-hackers(at)postgresql(dot)org>
Subject: RE: [Pgadmin] [Docker] servers.json import fails when running in desktop mode
Date: 2019-12-16 09:48:14
Message-ID: 74F4D0C2ACDFA04BA40C6475ADAE217529FA40C2@pdexchbalwst03.ad.insee.intra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

Here is a patch (first contribution \o/) that solves the issue by importing the servers.json anonymously when running in DESKTOP mode.
There may be a better way to check if we are running in DESKTOP mode or not but checking PGADMIN_CONFIG_SERVER_MODE should be enough when running pgadmin4 in docker.

Regards,
Olivier Levitt

________________________________________
From: Ashesh Vashi [ashesh(dot)vashi(at)enterprisedb(dot)com]
Sent: 14 December 2019 05:52
To: Levitt Olivier
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode

<http://www.linkedin.com/in/asheshvashi>

On Sat, Dec 14, 2019 at 3:53 AM Levitt Olivier <olivier(dot)levitt(at)insee(dot)fr<mailto:olivier(dot)levitt(at)insee(dot)fr>> wrote:
Hi,

When running the docker image in desktop mode (PGADMIN_CONFIG_SERVER_MODE=False), no user is created. That is expected behaviour.
But then the code that imports the servers.json pre-configuration fails as it ties the import to the default user.

I think line 40 of entrypoint.sh (https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=blob;f=pkg/docker/entrypoint.sh;h=47d14bf2d415777c64b221fb1fc75d61c5e3cecc;hb=HEAD) should not specify a user when running in dekstop mode.
I tested it without --user parameter and it successfully imported the servers.json configuration.

Should I submit a patch ? First time contributing to Pgadmin :)
Please do.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company<http://www.enterprisedb.com>

http://www.linkedin.com/in/asheshvashi

Regards,
Olivier Levitt

Attachment Content-Type Size
import_servers_on_desktop_mode.diff text/x-patch 978 bytes

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Aditya Toshniwal 2019-12-16 12:09:37 [pgAdmin][RM4988] Refactoring of all the SQL files used by pgAdmin4
Previous Message Ashesh Vashi 2019-12-14 05:05:28 pgAdmin 4 commit: Fixed any typo - we were using the function