-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.sh
More file actions
88 lines (70 loc) · 2.07 KB
/
Copy pathsetup.sh
File metadata and controls
88 lines (70 loc) · 2.07 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
checkProgram() {
if ! [ -x "$(command -v $1)" ]; then
echo "Error: $1 is not installed. Please install $1 and make sure the path is set in your environment." >&2
exit 1
fi
}
printMessage() {
RED='\033[1;36m'
NC='\033[0m'
printf "$RED$1$NC\n"
sleep 2
}
printMessage "########### Welcome to BoltCTF Setup #############"
printMessage "\nCHECKING: required programs and utilities..."
checkProgram php
checkProgram composer
checkProgram npm
printMessage "\nINSTALLING: dependencies..."
composer install --optimize-autoloader
npm install
printMessage "\nCHECKING: .env file..."
if [ -e .env ]; then
read -p "Would you like to keep your old .env file? (y/n) [y]" -n 1 -r
if [[ $REPLY =~ ^[Nn]$ ]]
then
rm .env
printMessage "Provide configuration for the database..."
read -p "Enter Your Database Name: " dbname
read -p "Enter Your Database User Name: " dbuser
read -p "Enter Your Database Password: " dbpassword
read -p "Enter Your Database Host name: " dbhostname
######### Excuse the weird indentation (silly cat!) #########
cat > .env << EOF
APP_ENV=production
APP_TZ=America/Chicago
APP_DEBUG=false
APP_KEY=
DB_HOST=$dbhostname
DB_DATABASE=$dbname
DB_USERNAME=$dbuser
DB_PASSWORD=$dbpassword
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=no-reply@example.com
MAIL_FROM_NAME=no-reply
EOF
######### Excuse the weird indentation (silly cat!) #########
fi
fi
printMessage "\nENCRYPTION KEYS: Type yes if running for the first time, else press enter key to skip"
php artisan passport:keys
php artisan key:generate
printMessage "\nBUILDING: asset libraries"
npm run prod
printMessage "\nRunning optimizer and migrator."
php artisan optimize
php artisan cache:clear
printMessage "\nType yes if running for the first time else press enter key to skip"
php artisan migrate --seed
printMessage "\nAll Done. Run 'php artisan serve' to launch the app."