|
@@ -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
|
|
|
}
|
|
|
|