I've been using, reluctantly, pgAdmin4 for the last couple of years or so.
And only because pgAdmin 3 became almost unusable with the recent PosgreSQL
versions. But at times, like when needing to view the list of active
sessions, pgAdmin 3 still is a better tool, even after all these years (I
mean, the new tool doesn't even show you the SQL of each session in the
session table, so you can't see at a glance what the DB is doing; You have
to manually inspect each session individually. Even using a SQL query on the
sessions table is better than using the pgAdmin 4 UI for this purpose).

Anyway, with the release of pgAdmin4 v5 it seems some steps in the right
direction, towards making it more like pgAdmin 3, have been made. Fore
example the desktop version finally doesn't need a web browser anymore (btw,
how can I change the font size in the v5 desktop version?).

However, going back to the topic, this extremely annoying "master password"
feature is still included in v5. And, when I say it's annoying, I'm not
talking about the use of the word "master", which some people may find
offensive. I'm talking about wasting hours of our lives by having to do
useless stuff repeatedly. This feature annoyed me so much, that part of my
master password is the F word, obviously referring to the feature.

So, today, after upgrading to v5, I tried to find a way to disable this time
waster, which should be opt-in anyway and configurable from the UI. But, for
some unfathomable reason, the PGAdmin devs decided to make us jump though
hoops again, and not allow us to easily disable the "feature". And the
documentation is extremely confusing regarding how to disable it.

To begin, there is a question mark on the master password password dialog,
which brings you to the documentation about the feature which says:

"You can disable the master password by setting the configuration parameter
MASTER_PASSWORD_REQUIRED=False. See Desktop Deployment for more
information."

OK, fine, obviously the option to change the configuration parameter should
be in the UI, shouldn't it? So I go to File -> Runtime -> Configure.
Surprise. It's not there. It's not in the preferences section either. OK,
time to read the Desktop Deployment help section.  First of all, the Desktop
Deployment help section immediatly tries to send me somewhere else with:

"See The config.py File for more information on configuration settings."

But I'll ignore that for the time being, and read the rest. Finally, at the
bottom of the Desktop Deployment help page, there is this:

"The configuration settings are stored in runtime_config.json file, which
will be available on Unix systems (~/.local/share/pgadmin/), on Mac OS X
(~/Library/Preferences/pgadmin), and on Windows (%APPDATA%/pgadmin)."

OK, so I open a command prompt and do a "cd %APPDATA%/pgadmin" since I'm on
Windows. This is what I find there:


Since runtime_config.json was mentioned, I list the file in the console:



Hmm. These parameters don't look at all like the one described in the
previous documentation page, about the master password. They are camelCase,
unlike the MASTER_PASSWORD_REQUIRED=False the master password documentation
page suggested I add. They are also in JSON format, so probably adding
"MASTER_PASSWORD_REQUIRED": false, or "MASTER_PASSWORD_REQUIRED": "False" to
that JSON is a bad idea, most likely the parameter must be set somewhere
else.

After a bit of Googling and Binging it seems the file I need to modify is a
.py file, not a .json file. However, there are no python files in that
directory. So I finally heed the advice on the documentation to "See The
config.py File for more information on configuration settings."

Since the documentation page for config.py is very long, I try do to a
Control+F on it to find the word "master". Unfortunately, this doesn't work
anymore in PgAdmin v5 since it's not a regular browser window. So I need to
look online for the same documentation, to be able to search it.

After a bit of Googling/Binging, I find this:

https://www.enterprisedb.com/edb-docs/d/pgadmin-4/reference/online-documentation/5.0/config_py.html

>From it:



So, indeed, that file seems to be related to this feature. Also, the
documentation page describes additional related files:

"There are multiple configuration files that are read at startup by pgAdmin.
These are as follows:

config.py: This is the main configuration file, and should not be modified.
It can be used as a reference for configuration settings, that may be
overridden in one of the following files.

config_distro.py: This file is read after config.py and is intended for
packagers to change any settings that are required for their pgAdmin
distribution. This may typically include certain paths and file locations.
This file is optional, and may be created by packagers in the same directory
as config.py if needed.

config_local.py: This file is read after config_distro.py and is intended
for end users to change any default or packaging specific settings that they
may wish to adjust to meet local preferences or standards.This file is
optional, and may be created by users in the same directory as config.py if
needed.

config_system.py: This file is read after config_local.py and is intended
for system administrators to include settings that are configured
system-wide from a secure location that users cannot normally modify and
that is outside of the pgAdmin installation. The location for this file
varies based on the platform, and only needs to be created if desired:

Linux: /etc/pgadmin/config_system.py

macOS: /Library/Preferences/pgadmin/config_system.py

Windows: %CommonProgramFiles%\pgadmin\config_system.py"

Hmm. So apparently the file I need to modify is config_local.py. And I need
to create it in the same directory as config.py. But obviously the
documentation doesn't bother to tell me in which directory config.py is,
that would be too simple. Instead it tells me where config_system.py should
be, and that directory doesn't even exist. It probably needs to be created,
just as the file:



So, running out of ideas, I just used a file manager (Total Commander) to
try to find the config.py file on my filesystem, since the documentation was
useless in this regard. Doing that found 35 config.py files on my main
drive, out of which 7 were related to pgAdmin4 v5, another 7 to v4, and the
other 21 were unrelated. Those related to v5 were:



The most likely one to be relevant seemed to be v5\web\config.py, and after
listing the files in that location it looked indeed like the correct
location:



Inspecting the file does indeed seem to show I'm in the correct location, as
it contains this:



So... this means, that to alter the configuration of the application I need
to create a config_local.py file here, with MASTER_PASSWORD_REQUIRED = False
. Not the greatest idea. Applications should have their user modifiable
configuration files in the application data folder. The program files folder
is dedicated for application binaries and other related files that shouldn't
be modified by the user.

But, at this point, two hours have passed from my Saturday night fighting
with pgAdmin 5, so I decide to stop trying to find a more elegant solution
to the problem, and just do it. Oh, but the operating system agrees that I,
as a user, have no business adding or modifying files directly there, so it
denies my access. 

Finally, running the file manager as administrator, I'm able to create the
file. I close pgAdmin. I reopen it. Finally. The time wasting dialog is
gone. It just that I had to waste another two hours to do that. And,
hopefully, it won't come back when updating pgAdmin. All this because some
devs have to be stubborn and not listen to their users. Sigh.



--
Sent from: 
https://www.postgresql-archive.org/PostgreSQL-pgadmin-support-f2191615.html


Reply via email to