-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.sh
executable file
·54 lines (41 loc) · 1.2 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
#!/usr/bin/bash
# checks if rust toolchain is installed
if ! command -v rustup &> /dev/null
then
echo "please install the rust toolchain to proceed"
exit
else
echo "rust toolchain is installed"
fi
# checks if node is installed and at least version 16
if ! command -v node &> /dev/null
then
echo "please install node to proceed"
exit
else
nodeVersion=$(node -v)
nodeVersion=${nodeVersion:1:2}
if [ "$nodeVersion" -gt 15 ]
then
echo "node is at least version 16"
else
echo "node must be at least version 16, please use nvm to install a newer version"
exit
fi
fi
cd frontend || exit
npm i
cd .. || exit
read -rp "Please input your PostgreSQL URL (example: postgres://postgres:password@localHost:5432/example): " DB_ENV
read -rp "If you have a test database please enter the URL, otherwise leave it blank: " TEST_DB_ENV
echo "DATABASE_URL=${DB_ENV}" > .env
if [ "$TEST_DB_ENV" = "" ];
then
echo "TEST_DATABASE_URL=${DB_ENV}" >> .env
else
echo "TEST_DATABASE_URL=${TEST_DB_ENV}" >> .env
fi
cargo install diesel_cli --no-default-features --features postgres
cd backend/migrations || exit
echo "performing database migrations"
diesel migration run