Update 99-run.sh

This commit is contained in:
Alexandre
2024-12-06 15:02:07 +01:00
committed by GitHub
parent 892af3117f
commit d86cdd81e3

View File

@@ -8,31 +8,23 @@ set -e
# Define database # # Define database #
################### ###################
bashio::log.info "Defining database" database="$(bashio::config 'database')"
bashio::log.info "Data selected : $database"
export DB_DATABASE="$(bashio::config 'DB_DATABASE')" case "$database" in
export DB_HOST="$(bashio::config 'DB_HOST')"
export DB_PASSWORD="$(bashio::config 'DB_PASSWORD')"
export DB_PORT="$(bashio::config 'DB_PORT')"
export DB_USERNAME="$(bashio::config 'DB_USERNAME')"
# Check if DB_HOST is configured # Use sqlite
if bashio::config.has_value "DB_HOST"; then sqlite)
bashio::log.info "Manual configuration of MySQL detected using host: $DB_HOST" mkdir -p database
# Alert if MariaDB is available touch database/database.sqlite
if bashio::services.available 'mysql'; then chown www-data:www-data database/database.sqlite
bashio::log.warning "The MariaDB addon is available, but you have selected to use your own database by manually configuring the addon options" bashio::log.blue "Using database/database.sqlite"
fi ;;
# Verify all variables are set
for var in DB_DATABASE DB_HOST DB_PASSWORD DB_PORT DB_USERNAME; do # Use Mariadb_addon
if ! bashio::config.has_value "$var"; then MariaDB_addon)
bashio::log.fatal "You have selected to not use the automatic MariaDB detection by manually configuring the addon options, but the option $var is not set."
exit 1
fi
done
else
# Use MariaDB # Use MariaDB
bashio::log.info "Using MariaDB addon. Requirements: running MariaDB addon. Discovering values..." bashio::log.green "Using MariaDB addon. Requirements: running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal "Local database access should be provided by the MariaDB addon" bashio::log.fatal "Local database access should be provided by the MariaDB addon"
bashio::exit.nok "Please ensure it is installed and started" bashio::exit.nok "Please ensure it is installed and started"
@@ -48,7 +40,26 @@ else
bashio::log.warning "Monica is using the MariaDB addon" bashio::log.warning "Monica is using the MariaDB addon"
bashio::log.warning "Please ensure this is included in your backups" bashio::log.warning "Please ensure this is included in your backups"
bashio::log.warning "Uninstalling the MariaDB addon will remove any data" bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
fi ;;
# Use Mariadb_addon
Mysql_external)
for var in DB_DATABASE DB_HOST DB_PASSWORD DB_PORT DB_USERNAME; do
# Verify all variables are set
if ! bashio::config.has_value "$var"; then
bashio::log.fatal "You have selected to not use the automatic MariaDB detection by manually configuring the addon options, but the option $var is not set."
exit 1
fi
export "$var=$(bashio::config "var")"
bashio::log.blue "$var=$(bashio::config "var")"
done
# Alert if MariaDB is available
if bashio::services.available 'mysql'; then
bashio::log.warning "The MariaDB addon is available, but you have selected to use your own database by manually configuring the addon options"
fi
;;
esac
########### ###########
# APP_KEY # # APP_KEY #