-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfull_reset.sh
executable file
·47 lines (41 loc) · 1.44 KB
/
full_reset.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/bash
# stop execution instantly on non-zero status. This is to know location of error
set -e
export DOCKER_BUILDKIT=1
GREEN="\e[32m"
BLUE="\e[34m"
ENDCOLOR="\e[0m"
# Environment variable paths used throughout the project
declare -a PathArray=(
".env" \
".localhost.env" \
".cloudflare.env" \
)
# Iterate over the paths and remove the files if present
# The [@] operator is get all elements, space-separated
for l_path in "${PathArray[@]}"; do
if [ -f "$l_path" ]; then
rm "$l_path"
fi
done
if [ -n "$1" ]; then
# Apply override settings, if present
DOMAIN="${1}"
export DOMAIN
echo -e "${GREEN}[INFO]${ENDCOLOR} DOMAIN is now set to ${BLUE}${DOMAIN}${ENDCOLOR}"
else
echo -e "${GREEN}[INFO]${ENDCOLOR} Optionally provide a top level domain \
(e.g. mydomain.com) as an argument to this script to change which domain hosting is \
configured for. Default is 'localhost'"
read -p ">> Enter your hosting top level domain [localhost]: " tld
DOMAIN=${tld:-localhost}
export DOMAIN
echo -e "${GREEN}[INFO]${ENDCOLOR} DOMAIN is now set to ${BLUE}${DOMAIN}${ENDCOLOR}"
fi
# Run the initialization script
/bin/bash ./initialize_env.sh
# Stop any currently running containers for this project.
# Remove containers for services not defined in the Compose file.
# Remove named volumes declared in the volumes section of the Compose file and anonymous
# volumes attached to containers.
docker compose down --remove-orphans --volumes