-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodeserver.sh
52 lines (40 loc) · 1.29 KB
/
nodeserver.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
#!/bin/bash
ENV_DEV="Development"
ENV_PROD="Production"
USER_ANONYMOUS_ID="563b3f1ce8d64c3f52ad008d"
USER_NORMAL_ID="563b3f77e8d64c3f52ad008e"
USER_ADMIN_ID="563b4018e8d64c3f52ad008f"
ENV_PROMPT="Select running configuration: "
USER_PROMPT="Select source user: "
ENV_OPTIONS=($ENV_DEV $ENV_PROD)
USER_OPTIONS=("Anonymous" "Regular" "Admin")
PS3="$ENV_PROMPT"
select opt in "${ENV_OPTIONS[@]}" "Escape"; do
case "$REPLY" in
1) echo "Starting $ENV_DEV configuration";
TARGET_ENV=$ENV_DEV; break;;
2) echo "Starting $ENV_PROD configuration";
TARGET_ENV=$ENV_PROD; break;;
$(( ${#ENV_OPTIONS[@]}+1 )) ) echo "Goodbye!"; break;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
PS3="$USER_PROMPT"
select opt in "${USER_OPTIONS[@]}" "Escape"; do
case "$REPLY" in
1) echo "Using anonymous profile";
TARGET_USER=$USER_ANONYMOUS_ID; break;;
2) echo "Using regular user profile";
TARGET_USER=$USER_NORMAL_ID; break;;
3) echo "Using admin user profile";
TARGET_USER=$USER_ADMIN_ID; break;;
$(( ${#USER_OPTIONS[@]}+1 )) ) echo "Goodbye!"; break;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
export NODE_ENV=$TARGET_ENV
export NODE_USER_ID=$TARGET_USER
cd "angular-spa-ui"
webpack
cd ".."
node app.js;