-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·99 lines (75 loc) · 2.84 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·99 lines (75 loc) · 2.84 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
echo -e "-------- FLOTILLA -----------"
echo -e "Running dev setup for Flotilla...\n"
flotilla_dir=$(dirname $0)
#-------- FRONTEND -----------
echo "-------- FRONTEND -----------"
echo -e "Setting up frontend ..."
if [ -f $flotilla_dir/frontend/.env ]; then
echo -e "WARNING: The file '$flotilla_dir/frontend/.env' already exists, it will be overwritten if the operation continues."
echo -e "Is this ok? (Y/n)"
read reply
if [ "$reply" = "n" ] || [ "$reply" = "N" ]; then
echo -e "\nFrontend setup - Aborted!"
frontend_abort="true"
fi
fi
if [ "$frontend_abort" != "true" ]; then
cp $flotilla_dir/frontend/.env.example $flotilla_dir/frontend/.env
echo -e "Created frontend/.env file from frontend/.env.example"
echo -e "Frontend setup - Done!"
fi
echo -e "-----------------------------\n"
#-------- BACKEND ------------
echo "-------- BACKEND ------------"
echo -e "Setting up backend .env /backend/api..."
backend_abort="false"
if [ -f $flotilla_dir/backend/api/.env ]; then
echo -e "WARNING: The file '$flotilla_dir/backend/api/.env' already exists, it will be overwritten if the operation continues."
echo -e "Is this ok? (Y/n)"
read reply
if [ "$reply" = "n" ] || [ "$reply" = "N" ]; then
echo -e "\nBackend setup - Aborted!\n"
backend_abort="true"
fi
fi
if [ "$backend_abort" != "true" ]; then
cp $flotilla_dir/backend/api/.env.example $flotilla_dir/backend/api/.env
echo -e "Created backend/api/.env file from backend/api/.env.example"
echo -e "Backend setup - Done!"
echo -e "-----------------------------\n"
fi
#-----------------------------
#--------- BROKER ------------
echo "--------- BROKER ------------"
echo -e "Setting up broker ..."
if [ -f $flotilla_dir/broker/.env ]; then
echo -e "WARNING: The file '$flotilla_dir/broker/.env' already exists, it will be overwritten if the operation continues."
echo -e "Is this ok? (Y/n)"
read reply
if [ "$reply" = "n" ] || [ "$reply" = "N" ]; then
echo -e "\nBroker setup - Aborted!\n"
broker_abort="true"
fi
fi
if [ "$broker_abort" != "true" ]; then
echo -e "Broker server key needed for broker dockerization."
echo -en "Input MQTT broker server key (copy-paste from KeyVault):\n"
while [ true ]
do
read -s broker_server_key
if [ -z "$broker_server_key" ]; then
echo "Flotilla broker server key cannot be empty"
echo "Try again:"
else
break
fi
done
echo "TLS_SERVER_KEY='$broker_server_key'" > $flotilla_dir/broker/.env
echo -e "Created broker/.env file with the broker server key"
echo -e "Broker setup - Done!"
echo -e "-----------------------------\n"
#-----------------------------
echo -e "Flotilla setup - Done!"
echo -e "-----------------------------"
fi