-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·59 lines (44 loc) · 1.52 KB
/
setup.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
#!/bin/bash
cd app/ || { echo "Repository app does not exist. Are you in the correct folder ?"; exit 1; }
if [ -f .env ]
then
echo "Already existing environment file";
else
touch .env;
echo "APP_ENV=dev" > .env;
{
echo "APP_SECRET=30b8d1c83771d3c9d6f32e77af433faf"
echo "# DATABASE_URL='sqlite:///%kernel.project_dir%/var/data.db'"
echo "# DATABASE_URL='mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4'"
echo "# DATABASE_URL='mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4'"
echo "# DATABASE_URL='mysql://username:password@host/database_name'"
echo "MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0"
} >> .env;
fi
if [ -f .env ]
then
echo ".env created properly";
else
echo "An error occurred when creating the .env file";
fi
echo "WARNING : Edit the .env file and add your database connection before proceeding."
while IFS= read -n1 -r -p "Is the file edited with correct credentials ? [y]es|[n]o " && [[ $REPLY != y ]]; do
case $REPLY in
n) echo "Waiting for user edit...";;
*) echo "Answer with [y] or [n]";;
esac
done
composer install
npm install
echo "Do you want to start the prod now ? y/N "
read -r answer
if [ "$answer" == 'y' ]
then
cd .. || { echo "Root folder does not exist. Did you correctly clone the project ? "; exit 1; }
if [ -f prod.sh ]
then
/bin/bash prod.sh;
else
echo "File prod.sh missing. Check the repository ?";
fi
fi