This repository was archived by the owner on Feb 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.sh
More file actions
123 lines (98 loc) · 2.4 KB
/
Copy pathsetup.sh
File metadata and controls
123 lines (98 loc) · 2.4 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
set_default () {
echo "ORIENT_HOST=localhost" > ./.env
echo "ORIENT_PORT=2424" >> ./.env
echo "ORIENT_USER=root" >> ./.env
echo "ORIENT_PASS=pass" >> ./.env
echo "DB_NAME=stoat" >> ./.env
echo "DB_USER=root" >> ./.env
echo "DB_PASS=pass" >> ./.env
echo "PORT=3001" >> ./.env
echo "REACT_APP_DB=http://localhost:3001" > ./client/.env
}
set_user_input () {
echo "ORIENT_HOST [default: localhost]: "
read -e host
if [ -z $host ]
then
echo "ORIENT_HOST=localhost" > ./.env
else
echo "ORIENT_HOST=$host" > ./.env
fi
echo "ORIENT_PORT [default: 2424]: "
read -e port
if [ -z $port ]
then
echo "ORIENT_PORT=2424" >> ./.env
else
echo "ORIENT_PORT=$port" >> ./.env
fi
echo "ORIENT_USER [default: root]: "
read -e user
if [ -z $user ]
then
echo "ORIENT_USER=root" >> ./.env
else
echo "ORIENT_USER=$user" >> ./.env
fi
echo "ORIENT_PASS [default: OrientPW]: "
read -e pass
if [ -z $pass ]
then
echo "ORIENT_PASS=OrientPW" >> ./.env
else
echo "ORIENT_PASS=$pass" >> ./.env
fi
echo "DB_NAME [default: stoat]: "
read -e name
if [ -z $name ]
then
echo "DB_NAME=2424" >> ./.env
else
echo "DB_NAME=$name" >> ./.env
fi
echo "DB_USER [default: root]: "
read -e dbuser
if [ -z $dbuser ]
then
echo "DB_USER=root" >> ./.env
else
echo "DB_USER=$dbuser" >> ./.env
fi
echo "DB_PASS [default: OrientPW]: "
read -e dbpass
if [ -z $dbpass ]
then
echo "DB_PASS=OrientPW" >> ./.env
else
echo "DB_PASS=$dbpass" >> ./.env
fi
echo "Server PORT [default: 3001]: "
read -e sport
if [ -z $sport ]
then
echo "PORT=3001" >> ./.env
echo "REACT_APP_DB=http://localhost:3001" > ./client/.env
else
echo "PORT=$sport" >> ./.env
echo "REACT_APP_DB=http://localhost:$sport" > ./client/.env
fi
}
echo "Setting up STOAT environment variables."
echo "Do you want to use the default values? (Y, n): "
read -e opt
if [ -z $opt ]
then
opt='y'
fi
if [ $opt = 'n' ] || [ $opt = 'N' ]
then
set_user_input
else
set_default
fi
echo "Environment variables have been set up. They can be found in ./.env and ./client/.env"
echo "./.env :"
cat ./.env
echo "./client/.env :"
cat ./client/.env