3x-ui/wait-for-postgres.sh
izzzzzi 2fbd1d860d feat: add PostgreSQL support and database configuration options
- Updated Docker configuration to support PostgreSQL as an alternative to SQLite.
- Enhanced DockerEntrypoint.sh to create a database environment file and test PostgreSQL connection.
- Introduced database setup functions in install.sh for PostgreSQL installation and configuration.
- Added database management options in x-ui.sh, including backup and switching between SQLite and PostgreSQL.
- Implemented database configuration retrieval in the web service and controller layers.
- Updated frontend settings to include database configuration options.
- Added translations for new database settings in multiple languages.
2025-05-23 02:00:06 +05:00

17 lines
No EOL
303 B
Bash

#!/bin/bash
set -e
host="$1"
port="$2"
user="$3"
database="$4"
shift 4
cmd="$@"
until PGPASSWORD="$DB_PASSWORD" psql -h "$host" -p "$port" -U "$user" -d "$database" -c '\q'; do
>&2 echo "PostgreSQL is unavailable - sleeping"
sleep 1
done
>&2 echo "PostgreSQL is up - executing command"
exec $cmd