forked from docksal/addons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailhog.pre-install
43 lines (34 loc) · 1.03 KB
/
mailhog.pre-install
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
#!/usr/bin/env bash
# Check Docksal running
if [[ "$DOCKER_RUNNING" != "true" ]]; then
echo "[PRE-INSTALL] ERROR: Docksal and project should be running"
exit 1
fi
# Check Docksal running
if [[ "$ADDON_GLOBAL" == "true" ]]; then
echo -e "[PRE-INSTALL] ERROR: Mailhog addon should not be installed globally"
exit 1
fi
# Check project running
if ! (fin ps | grep "_cli_" | grep "Up" >/dev/null); then
echo "[PRE-INSTALL] ERROR: Start the project with fin start first"
exit 1
fi
# Get fin config
fin_config=$(fin config)
if [[ $? != 0 ]]; then
echo "[PRE-INSTALL] ERROR: 'fin config' command was not successful. Check your fin config"
exit 1
fi
# Check there is no mailhog already
if (echo "$fin_config" | grep "image: mailhog\/mailhog"); then
echo "[PRE-INSTALL] ERROR: Mailhog seems to be already enabled for this project"
exit 1
fi
# Check there is no mailhog already
if (echo "$fin_config" | grep " mail:"); then
echo "[PRE-INSTALL] ERROR: Container named 'mail' already exists. Remove it to continue."
exit 1
fi
# All good
exit 0