Allow preferences customization using a configuration file. #6058

This commit is contained in:
Yogesh Mahajan
2024-02-15 14:58:31 +05:30
committed by GitHub
parent a74b0232f9
commit 5a74022e8a
7 changed files with 102 additions and 15 deletions

View File

@@ -75,6 +75,17 @@ if [ ! -f /var/lib/pgadmin/pgadmin4.db ]; then
/venv/bin/python3 /pgadmin4/setup.py load-servers "${PGADMIN_SERVER_JSON_FILE}" --user "${PGADMIN_DEFAULT_EMAIL}"
fi
fi
if [ -f "${PGADMIN_PREFERENCES_JSON_FILE}" ]; then
# When running in Desktop mode, no user is created
# so we have to import servers anonymously
if [ "${PGADMIN_CONFIG_SERVER_MODE}" = "False" ]; then
DESKTOP_USER=$(cd /pgadmin4 && /venv/bin/python3 -c 'import config; print(config.DESKTOP_USER)')
/venv/bin/python3 /pgadmin4/setup.py set-prefs "${DESKTOP_USER}" --input-file "${PGADMIN_PREFERENCES_JSON_FILE}"
else
/venv/bin/python3 /pgadmin4/setup.py set-prefs "${PGADMIN_DEFAULT_EMAIL}" --input-file "${PGADMIN_PREFERENCES_JSON_FILE}"
fi
fi
fi
# Start Postfix to handle password resets etc.