-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevelopment.sh
31 lines (24 loc) · 932 Bytes
/
development.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
#!/usr/bin/env bash
set -e
mode=$1
if [ "$#" -ne 1 ]; then
echo "Invalid number of arguments. Example: ./restore_mongo.sh {mode=monorepo/docker}"
exit 1
fi
if [[ $mode != 'monorepo' && $mode != 'docker' ]]; then
echo "Invalid mode, only monorepo or docker is allowed."
exit 1
fi
cp frontend/.env.sample frontend/.env.development
cp backend/.env.example backend/.env
# Remove these 2 folder when switching mode because:
# Docker mode create them in root user
# Monorepo mode create then in non-root user mode
# TODO: Fix Docker to create with non-root user (hehe)
sudo rm -rf backend/node_modules backend/dist
sed -i 's/{API_HOST}/http:\/\/localhost:3000/' frontend/.env.development
if [[ $mode = 'monorepo' ]]; then
sed -i 's/{MONGO_URL}/mongodb:\/\/127.0.0.1:27017\/damenu/' backend/.env
elif [[ $mode = 'docker' ]]; then
sed -i 's/{MONGO_URL}/mongodb:\/\/damenu-mongo:27017\/damenu/' backend/.env
fi