-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·46 lines (37 loc) · 1000 Bytes
/
install.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
#!/bin/bash
env_file=.env
ask() {
echo ""
echo "${@:2}"
read -r -p "$1=" response
echo "$1='$response'" >> $env_file
}
randomize() {
rand=`openssl rand -hex 20`
for arg in "$@"; do
echo "$arg='$rand'" >> $env_file
done
}
setup() {
echo "" > $env_file
ask CAMPUS_ID What is your CAMPUS_ID on the intranet?
ask FT_UID What is your API client_id for this app?
ask FT_SECRET What is your API secret for this app?
echo "POSTGRES_DB='keychain'" >> $env_file
echo "POSTGRES_USER='keychain'" >> $env_file
randomize POSTGRES_PASSWORD
ask NEXTAUTH_URL "What will be the URL of the website e.g: https://keychain.hive.fi (in dev: http://localhost:4001)"
randomize SECRET NEXTAUTH_SECRET
echo ""
echo "Thank you! your $env_file is now setup"
}
if [ -f "$env_file" ]; then
read -r -p "WARNING! This will remove your current .env file. Are you sure you want to continue? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
rm $env_file
else
exit 0;
fi
fi
setup