-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfigure.sh
executable file
·68 lines (52 loc) · 1.17 KB
/
configure.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
exec 3>&1
# First an accident check
if [[ -f .env ]]
then
dialog --defaultno --yesno "A .env file already exist. Proceed and overwrite?" 0 0
if [[ $? != 0 ]]
then
clear
echo "Cancelled."
exit 0
fi
fi
# Domain name (required)
domain=""
while [[ "$domain" == "" ]]
do
domain=$(dialog --inputbox "Enter your domain name" 0 0 2>&1 1>&3)
if [[ $? != 0 ]]
then
clear
echo "Cancelled."
exit 1
fi
done
# Certbot (optional)
email=""
dialog --yesno "Do you want a Let's Encrypt certificate for HTTPS?" 7 40
if [[ $? == 0 ]]
then
while [[ "$email" == "" ]]
do
email=$(dialog --inputbox "Enter your email address (for Let's Encrypt)" 0 0 2>&1 1>&3)
if [[ $? != 0 ]]
then
break
fi
done
fi
# Abuse report webhook (optional)
discord_webhook=$(dialog --inputbox "If you have a Discord channel you'd like to send abuse reports to, paste the webhook URL here:" 0 0 2>&1 1>&3)
echo "DOMAIN=$domain" > .env
if [[ "$email" != "" ]]
then
echo "USE_CERTBOT=yes" >> .env
echo "EMAIL=$email" >> .env
else
echo "USE_CERTBOT=no" >> .env
echo "EMAIL=" >> .env
fi
echo "DISCORD_WEBHOOK=$discord_webhook" >> .env
sed -i "s/__DOMAIN__/${domain}/" public_html/index.html