From 64e1d76ccf964a0b21ffc61d8520353a3506bd07 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 3 Jul 2022 01:01:46 +0200 Subject: [PATCH] Remove redis_db --- conf/.env | 2 +- scripts/_common.sh | 43 +------------------------------------------ scripts/install | 4 ---- scripts/remove | 8 -------- 4 files changed, 2 insertions(+), 55 deletions(-) diff --git a/conf/.env b/conf/.env index 7a447f3..c495a9f 100644 --- a/conf/.env +++ b/conf/.env @@ -79,7 +79,7 @@ CACHE_PREFIX=snipeit # -------------------------------------------- REDIS_HOST="127.0.0.1" REDIS_PASSWORD=null -REDIS_PORT=__REDIS_DB__ +REDIS_PORT=6379 # -------------------------------------------- # OPTIONAL: MEMCACHED SETTINGS diff --git a/scripts/_common.sh b/scripts/_common.sh index 1f62eec..01e0d3f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,7 +10,7 @@ YNH_PHP_VERSION="7.3" YNH_COMPOSER_VERSION=2.0.14 # dependencies used by the app -pkg_dependencies="openssl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-gd" +pkg_dependencies="openssl redis php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-redis" #================================================= # PERSONAL HELPERS @@ -20,44 +20,3 @@ pkg_dependencies="openssl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-c # EXPERIMENTAL HELPERS #================================================= -#================================================= -# REDIS HELPERS -#================================================= - -# get the first available redis database -# -# usage: ynh_redis_get_free_db -# | returns: the database number to use -ynh_redis_get_free_db() { - local result max db - result="$(redis-cli INFO keyspace)" - - # get the num - max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+") - - db=0 - # default Debian setting is 15 databases - for i in $(seq 0 "$max") - do - if ! echo "$result" | grep -q "db$i" - then - db=$i - break 1 - fi - db=-1 - done - - test "$db" -eq -1 && ynh_die --message="No available Redis databases..." - - echo "$db" -} - -# Create a master password and set up global settings -# Please always call this script in install and restore scripts -# -# usage: ynh_redis_remove_db database -# | arg: database - the database to erase -ynh_redis_remove_db() { - local db=$1 - redis-cli -n "$db" flushall -} diff --git a/scripts/install b/scripts/install index efdaa02..e294c32 100755 --- a/scripts/install +++ b/scripts/install @@ -120,10 +120,6 @@ ynh_install_composer #================================================= ynh_script_progression --message="Adding a configuration file..." -# Configure redis -redis_db=$(ynh_redis_get_free_db) -ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" - app_key="" ynh_add_config --template="../conf/.env" --destination="$final_path/.env" diff --git a/scripts/remove b/scripts/remove index a8d9a5a..6a62cf1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -20,17 +20,9 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # STANDARD REMOVE -#================================================= -# REMOVE THE REDIS DATABASE -#================================================= -ynh_script_progression --message="Removing the redis database..." - -ynh_redis_remove_db "$redis_db" - #================================================= # REMOVE THE MYSQL DATABASE #=================================================