-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
63 lines (52 loc) · 2.55 KB
/
config.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
#!/usr/bin/env bash
project_name="vaultwarden"
envfile_path="/usr/local/etc/rc.conf.d/vaultwarden"
echo "Starting $project_name Setup"
service vaultwarden stop
cp /usr/local/etc/rc.conf.d/vaultwarden.sample $envfile_path
clear
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo " \ \ / //\ | | | || | |__ __|\ \ / //\ | __ \ | __ \ | ____|| \ | |";
echo " \ \ / // \ | | | || | | | \ \ /\ / // \ | |__) || | | || |__ | \| |";
echo " \ \/ // /\ \ | | | || | | | \ \/ \/ // /\ \ | _ / | | | || __| | . \` |";
echo " \ // ____ \| |__| || |____ | | \ /\ // ____ \ | | \ \ | |__| || |____ | |\ |";
echo " \//_/ \_\\____/ |______||_| \/ \//_/ \_\|_| \_\|_____/ |______||_| \_|";
echo " "
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo " MANAGED $project_name SCRIPTED INSTALLER "
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo
echo
read -p "Do you want to Install the Database server as well?? Enter \"N\" if you have database server running." -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "WILL BE ADDED IN THE FUTURE"
fi
echo "Enter Database Hostname or IP Address: "
read -p ">>" db_hostname
echo "Enter Database Name: "
read -p ">>" db_name
echo "Enter Database Username: "
read -p ">>" db_username
echo "Enter Database Password: "
read -p ">>" db_password
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo "Entered Details are Below"
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo "DB_HOSTNAME = $db_hostname"
echo "DB_DATABASE = $db_name"
echo "DB_USERNAME = $db_username"
echo "DB_PASSWORD = $db_password"
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
# Server IP/Port 192.168.1.10:3306 UN: dbuser / PW: yourpassword / DB: vaultwarden
# mysql://dbuser:[email protected]:3306/vaultwarden
echo "DATABASE_URL=mysql://$db_username:$db_password@$db_hostname:3306/$db_name">> $envfile_path
echo 'export DATABASE_URL' >> $envfile_path
echo "Database Connection Complete"
echo "Enabled Public Ip Access"
find $envfile_path -type f -exec sed -i '' -e "/^ROCKET_ADDRESS=/s/=.*/=0.0.0.0/" {} \;
echo "Enabled Signup"
find $envfile_path -type f -exec sed -i '' -e "/^SIGNUPS_ALLOWED=/s/=.*/='true'/" {} \;
echo "Setup complete"
service vaultwarden start