diff options
author | Florian Brandes <florian.brandes@posteo.de> | 2023-02-07 12:23:24 +0100 |
---|---|---|
committer | Florian Brandes <florian.brandes@posteo.de> | 2023-02-09 08:19:05 +0100 |
commit | a380674d85f465c581b0b8a5a9c2df5d8aad9cae (patch) | |
tree | 7b035df5559945c11bc1264d09d8d57017f08fa3 /pkgs/tools/admin/pgadmin/check-system-config-dir.patch | |
parent | 2b63943be41006ae3e656a76670b3b5e718437a3 (diff) |
pgadmin4: add option to enable desktop mode
By default, pgadmin4 uses SERVER_MODE = True. This requires access to system directories (e.g. /var/lib/pgadmin). There is no easy way to change this mode during runtime. One has to change or add config files withing pgadmin's directory structure to change it or add a system-wide config file under `/etc/pgadmin`[1]. This isn't always easy to achive or may not be possible at all. For those usecases this implements a switch in the pgadmin4 derivation and adds a new top-level package `pgadmin4-desktopmode`. This builds in DESKTOP MODE and allows the usage of pgadmin4 without the nixOS module and without access to system-wide directories. pgadmin4 module saves the configuration to /etc/pgadmin/config_system.py pgadmin4-desktopmode tries to read that as well. This normally fails with a PermissionError, as the config file is owned by the user of the pgadmin module. With the check-system-config-dir.patch this will just throw a warning but will continue and not read the file. If we run pgadmin4-desktopmode as root (something one really shouldn't do), it can read the config file and fail, because of the wrong config for desktopmode. [1]https://www.pgadmin.org/docs/pgadmin4/latest/config_py.html Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
Diffstat (limited to 'pkgs/tools/admin/pgadmin/check-system-config-dir.patch')
-rw-r--r-- | pkgs/tools/admin/pgadmin/check-system-config-dir.patch | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/tools/admin/pgadmin/check-system-config-dir.patch b/pkgs/tools/admin/pgadmin/check-system-config-dir.patch new file mode 100644 index 0000000000000..f614bab64e6fd --- /dev/null +++ b/pkgs/tools/admin/pgadmin/check-system-config-dir.patch @@ -0,0 +1,17 @@ +diff --git a/web/config.py b/web/config.py +index 4774043..5b73fd3 100644 +--- a/web/config.py ++++ b/web/config.py +@@ -884,6 +884,12 @@ if os.path.exists(system_config_dir + '/config_system.py'): + user_config_settings.update(config_system_settings) + except ImportError: + pass ++ except PermissionError: ++ print(f"Permission denied to open {str(system_config_dir + '/config_system.py')}. \n \ ++ If you are running pgadmin4-desktopmode please make sure you disable \n \ ++ the pgadmin NixOS module first. If you rely on settings in \n \ ++ {str(system_config_dir + '/config_system.py')}, please check the correct permissions.") ++ pass + + # Update settings for 'LOG_FILE', 'SQLITE_PATH', 'SESSION_DB_PATH', + # 'AZURE_CREDENTIAL_CACHE_DIR', 'KERBEROS_CCACHE_DIR', 'STORAGE_DIR' \ No newline at end of file |