From f35a3d9d739fb423c641f3b25c22f308462c6122 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:42:03 +0100 Subject: [PATCH] Update 99-run.sh --- postgres/rootfs/etc/cont-init.d/99-run.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/postgres/rootfs/etc/cont-init.d/99-run.sh b/postgres/rootfs/etc/cont-init.d/99-run.sh index 3f554eb14..05e56ddad 100755 --- a/postgres/rootfs/etc/cont-init.d/99-run.sh +++ b/postgres/rootfs/etc/cont-init.d/99-run.sh @@ -29,8 +29,18 @@ chmod 777 "$PGDATA" # Permissions chmod -R 777 "$CONFIG_HOME" -# Copy new config -# cp "$CONFIG_HOME"/postgresql.conf /config/ +##################### +# Prepare vector.rs # +##################### + +# Set variables for vector.rs +export DB_PORT=5432 +export DB_HOSTNAME=localhost +export DB_USERNAME=postgres +export DB_PASSWORD="$(bashio::config 'POSTGRES_PASSWORD')" +echo "DROP EXTENSION IF EXISTS vectors; + CREATE EXTENSION vectors; +\q"> setup_postgres.sql ############## # Launch App # @@ -45,8 +55,9 @@ echo " " # Add docker-entrypoint command if "$(bashio::info.arch)" != "armv7"; then + sed -i "/exec \"\$@\"/i psql \"postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT\" < setup_postgres.sql || true" docker-entrypoint.sh docker-entrypoint.sh postgres -c shared_preload_libraries=vectors.so else bashio::log.warning "Your architectur is armv7, vector.rs is disabled as not supported" - docker-entrypoint.sh postgres + docker-entrypoint.sh postgres fi