mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-30 19:26:07 +02:00
update
This commit is contained in:
19
ente/rootfs/etc/services.d/00-postgres/run
Normal file
19
ente/rootfs/etc/services.d/00-postgres/run
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
set -euo pipefail
|
||||
|
||||
if bashio::config.true 'USE_EXTERNAL_DB'; then
|
||||
bashio::log.info "External DB requested; not starting internal Postgres service."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export PGDATA=/data/postgres
|
||||
mkdir -p "$PGDATA"
|
||||
chown -R postgres:postgres /data
|
||||
|
||||
if [[ ! -s "$PGDATA/PG_VERSION" ]]; then
|
||||
bashio::log.info "Initializing Postgres 17 data directory."
|
||||
su - postgres -c "/usr/lib/postgresql/17/bin/initdb -D $PGDATA"
|
||||
fi
|
||||
|
||||
bashio::log.info "Starting Postgres 17 (listening on 127.0.0.1:5432)."
|
||||
exec su - postgres -c "/usr/lib/postgresql/17/bin/postgres -D $PGDATA -c listen_addresses='127.0.0.1'"
|
||||
Reference in New Issue
Block a user