mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-03 16:00:29 +01:00
Check if vectors is enabled
This commit is contained in:
@@ -150,6 +150,20 @@ EOF
|
||||
bashio::log.info "Database setup completed successfully."
|
||||
}
|
||||
|
||||
# Function to check if vectors extension is enabled
|
||||
check_vector_extension() {
|
||||
echo "Checking if 'vectors' extension is enabled..."
|
||||
RESULT=$(psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT" -tAc "SELECT extname FROM pg_extension WHERE extname = 'vectors';")
|
||||
|
||||
if [[ "$RESULT" == "vectors" ]]; then
|
||||
echo "✅ 'vectors' extension is enabled."
|
||||
exit 0
|
||||
else
|
||||
bashio::log.warning "❌ 'vectors' extension is NOT enabled."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#########################
|
||||
# Main script execution #
|
||||
#########################
|
||||
@@ -171,3 +185,4 @@ export_db_env
|
||||
|
||||
setup_root_user
|
||||
setup_database
|
||||
check_vector_extension
|
||||
|
||||
@@ -59,7 +59,8 @@ bashio::log.info "Enabling vector.rs"
|
||||
DB_PORT=5432
|
||||
DB_HOSTNAME=localhost
|
||||
DB_PASSWORD="$(bashio::config 'POSTGRES_PASSWORD')"
|
||||
if bashio::config.has_value "POSTGRES_USER"; then DB_USERNAME="$(bashio::config "POSTGRES_USER")"; else DB_USERNAME=postgres; fi
|
||||
DB_USERNAME=postgres
|
||||
if bashio::config.has_value "POSTGRES_USER"; then DB_USERNAME="$(bashio::config "POSTGRES_USER")"; fi
|
||||
|
||||
export DB_PORT
|
||||
export DB_HOSTNAME
|
||||
|
||||
Reference in New Issue
Block a user