-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·93 lines (85 loc) · 2.56 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
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
#!/usr/bin/env bash
echo ':: Database Configurations'
echo
echo 'A PostgreSQL database container will be created in docker compose service.'
echo 'Please enter the information about the database instance will be created.'
echo
read -p 'Database Name [hops]: ' dbName
read -p 'Username [hops]: ' dbUsername
read -sp 'Password [secret]: ' dbPassword
echo
echo
echo
echo ':: Initial User Configuration'
echo
echo 'Initial user will be created on first run.'
echo 'Please enter the information about the initial user.'
echo
read -p 'Initial user email: ' initialUserEmail
while [[ $initialUserEmail == '' ]]
do
echo 'Please enter the initial user email.'
read -p "Initial user email: " initialUserEmail
done
read -sp 'Default user password: ' defaultUserPassword
echo
while [[ $defaultUserPassword == '' ]]
do
echo 'Please enter the default user password.'
read -sp "Default user password: " defaultUserPassword
echo
done
echo
echo
echo ':: Secret Key Configuration'
echo
echo 'Please provide a secret key to secure the login and authentication process.'
echo 'Secret key must be base64-encoded value of string of 32 bytes in size.'
echo "If you don't know how to make secret key, please read README.md."
echo
read -sp 'Secret Key: ' secretKey
echo
while [[ $secretKey == '' ]]
do
echo 'Please enter the secret key.'
read -sp "Secret Key: " secretKey
echo
done
echo
echo
echo ':: Deploy Domain Configuration'
echo
echo 'Keeping the settings at their defaults is sufficient for a quick try.'
echo 'However, if you want to actually use it with a reverse proxy or something,'
echo "you'll need to change the settings on docker-compose.yaml."
echo
read -p 'Deploy Domain [localhost]: ' deployDomain
echo
echo
echo ':: Google OAuth 2.0 Client Configuration'
echo
echo 'To add a Google Sheets data source please provide OAuth2 2.0 Client ID and secret.'
echo "Leave an empty value if you don't need it now. You can add it later by modifying .env."
echo
read -p 'Client ID: ' googleClientId
read -sp 'Client Secret: ' googleClientSecret
echo
echo
echo
echo ':: License Configuration'
echo
echo 'You need a license to try Hops. Please enter your license ID.'
echo
read -p "License ID: " licenseId
while [[ $licenseId == '' ]]
do
echo 'Please enter the license ID.'
read -p "License ID: " licenseId
done
echo
echo
echo 'Configuration finished! Saving configurations...'
./scripts/build_env.sh \
"$dbName" "$dbUsername" "$dbPassword" "$initialUserEmail" "$defaultUserPassword" "$secretKey" "$deployDomain" \
"$googleClientId" "$googleClientSecret" "$licenseId" "" \
> .env