File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6767 done
6868fi
6969
70+ # Ensures the variable starts and ends in quotes after trimming
71+ ensure_quoted () {
72+ local var=" $1 "
73+
74+ # Trim whitespaces
75+ var=" ${var# " ${var%% [![:space:]]* } " } "
76+ var=" ${var% " ${var##* [![:space:]]} " } "
77+
78+ # Check if the variable is already double or single quoted
79+ if [[ ! $var =~ ^\" (.* )\" $ && ! $var =~ ^\' (.* )\' $ ]]; then
80+ # Use docstrings in case the value contains quote characters inside
81+ var=" '''${var} '''"
82+ fi
83+
84+ echo " ${var} "
85+ }
86+
7087# Check whether the external configuration database exists if it is being used.
7188external_config_db_exists=" False"
7289if [ -n " ${PGADMIN_CONFIG_CONFIG_DATABASE_URI} " ]; then
73- external_config_db_exists=$( cd /pgadmin4/pgadmin/utils && /venv/bin/python3 -c " from check_external_config_db import check_external_config_db; val = check_external_config_db(" ${PGADMIN_CONFIG_CONFIG_DATABASE_URI} " ); print(val)" )
90+ # Support both quoted and unquoted URIs for backwards compatibility
91+ PGADMIN_CONFIG_CONFIG_DATABASE_URI=$( ensure_quoted " ${PGADMIN_CONFIG_CONFIG_DATABASE_URI} " )
92+
93+ external_config_db_exists=$( cd /pgadmin4/pgadmin/utils && /venv/bin/python3 -c " from check_external_config_db import check_external_config_db; val = check_external_config_db(${PGADMIN_CONFIG_CONFIG_DATABASE_URI} ); print(val)" )
7494fi
7595
7696# DRY of the code to load the PGADMIN_SERVER_JSON_FILE
You can’t perform that action at this time.
0 commit comments