Browse Source

refactor: Remove leftover data location configuration options

Owen Diffey 1 month ago
parent
commit
0ab46273e7

+ 0 - 2
.env.example

@@ -13,11 +13,9 @@ FRONTEND_PROD_DEVTOOLS=false
 MONGO_ROOT_PASSWORD=PASSWORD_HERE
 MONGO_USER_USERNAME=musare
 MONGO_USER_PASSWORD=OTHER_PASSWORD_HERE
-MONGO_DATA_LOCATION=.db
 MONGO_VERSION=6
 
 REDIS_PASSWORD=PASSWORD
-REDIS_DATA_LOCATION=.redis
 
 BACKUP_LOCATION=
 BACKUP_NAME=

+ 0 - 2
.github/workflows/automated-tests.yml

@@ -8,10 +8,8 @@ env:
     MONGO_ROOT_PASSWORD: PASSWORD_HERE
     MONGO_USER_USERNAME: musare
     MONGO_USER_PASSWORD: OTHER_PASSWORD_HERE
-    MONGO_DATA_LOCATION: .db
     MONGO_VERSION: 5.0
     REDIS_PASSWORD: PASSWORD
-    REDIS_DATA_LOCATION: .redis
 
 jobs:
     tests:

+ 0 - 2
.github/workflows/build.yml

@@ -8,10 +8,8 @@ env:
     MONGO_ROOT_PASSWORD: PASSWORD_HERE
     MONGO_USER_USERNAME: musare
     MONGO_USER_PASSWORD: OTHER_PASSWORD_HERE
-    MONGO_DATA_LOCATION: .db
     MONGO_VERSION: 5.0
     REDIS_PASSWORD: PASSWORD
-    REDIS_DATA_LOCATION: .redis
 
 jobs:
     build:

+ 0 - 2
.github/workflows/lint.yml

@@ -8,10 +8,8 @@ env:
     MONGO_ROOT_PASSWORD: PASSWORD_HERE
     MONGO_USER_USERNAME: musare
     MONGO_USER_PASSWORD: OTHER_PASSWORD_HERE
-    MONGO_DATA_LOCATION: .db
     MONGO_VERSION: 5.0
     REDIS_PASSWORD: PASSWORD
-    REDIS_DATA_LOCATION: .redis
 
 jobs:
     lint:

+ 0 - 2
.wiki/Configuration.md

@@ -35,10 +35,8 @@ machine, even though the application within the container is listening on `21017
 | `MONGO_ROOT_PASSWORD` | Password of the root/admin user for MongoDB. |
 | `MONGO_USER_USERNAME` | Application username for MongoDB. |
 | `MONGO_USER_PASSWORD` | Application password for MongoDB. |
-| `MONGO_DATA_LOCATION` | The location where MongoDB stores its data. Usually the `.db` folder inside the `Musare` folder. |
 | `MONGO_VERSION` | The MongoDB version to use for scripts and docker compose. Must be numerical. Currently supported MongoDB versions are 4.0+. Always make a backup before changing this value. |
 | `REDIS_PASSWORD` | Redis password. |
-| `REDIS_DATA_LOCATION` | The location where Redis stores its data. Usually the `.redis` folder inside the `Musare` folder. |
 | `BACKUP_LOCATION` | Directory to store musare.sh backups. Defaults to `/backups` in script location. |
 | `BACKUP_NAME` | Name of musare.sh backup files. Defaults to `musare-$(date +"%Y-%m-%d-%s").dump`. |
 | `MUSARE_SITENAME` | Should be the name of the site. [^1] |

+ 4 - 24
musare.sh

@@ -201,19 +201,11 @@ handleReset()
         throw "${servicesString:2}\n${YELLOW}Usage: ${1} [backend, frontend, mongo, redis]"
     fi
 
-    if [[ ${servicesString:2:4} == "all" ]]; then
-        echo -e "${RED}Resetting will remove the ${REDIS_DATA_LOCATION} and ${MONGO_DATA_LOCATION} directories.${NC}"
-        echo -e "${GREEN}Are you sure you want to reset all data? ${YELLOW}[y,n]: ${NC}"
-    else
-        if [[ "${servicesString:2}" == *redis* && "${servicesString:2}" == *mongo* ]]; then
-            echo -e "${RED}Resetting will remove the ${REDIS_DATA_LOCATION} and ${MONGO_DATA_LOCATION} directories.${NC}"
-        elif [[ "${servicesString:2}" == *redis* ]]; then
-            echo -e "${RED}Resetting will remove the ${REDIS_DATA_LOCATION} directory.${NC}"
-        elif [[ "${servicesString:2}" == *mongo* ]]; then
-            echo -e "${RED}Resetting will remove the ${MONGO_DATA_LOCATION} directory.${NC}"
-        fi
-        echo -e "${GREEN}Are you sure you want to reset all data for $(echo "${servicesString:2}" | tr ' ' ',')? ${YELLOW}[y,n]: ${NC}"
+    confirmMessage="${GREEN}Are you sure you want to reset all data"
+    if [[ ${servicesString:2:4} != "all" ]]; then
+        confirmMessage="${confirmMessage} for $(echo "${servicesString:2}" | tr ' ' ',')"
     fi
+    echo -e "${confirmMessage}? ${YELLOW}[y,n]: ${NC}"
 
     read -r confirm
     if [[ "${confirm}" != y* ]]; then
@@ -223,23 +215,11 @@ handleReset()
     if [[ ${servicesString:2:4} == "all" ]]; then
         runDockerCommand "$(basename "$0") $1" stop
         ${dockerCompose} rm -v --force
-        if [[ -d $REDIS_DATA_LOCATION ]]; then
-            rm -rf "${REDIS_DATA_LOCATION}"
-        fi
-        if [[ -d $MONGO_DATA_LOCATION ]]; then
-            rm -rf "${MONGO_DATA_LOCATION}"
-        fi
     else
         # shellcheck disable=SC2086
         runDockerCommand "$(basename "$0") $1" stop ${servicesString:2}
         # shellcheck disable=SC2086
         ${dockerCompose} rm -v --force ${servicesString:2}
-        if [[ "${servicesString:2}" == *redis* && -d $REDIS_DATA_LOCATION ]]; then
-            rm -rf "${REDIS_DATA_LOCATION}"
-        fi
-        if [[ "${servicesString:2}" == *mongo* && -d $MONGO_DATA_LOCATION ]]; then
-            rm -rf "${MONGO_DATA_LOCATION}"
-        fi
     fi
 }