-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstart_auth2
executable file
·111 lines (103 loc) · 2.28 KB
/
start_auth2
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
#!/bin/bash
shopt -s nocasematch;
PORT=""
runtype="server"
if [[ "$1" == "" ]]
then
envfile=".env.standalone"
backend="false"
elif [[ -f ".env.$1" ]]
then
envfile=".env.$1"
if [[ "$2" == "" ]]
then
backend="false"
elif [[ "$2" =~ ^(true|false)$ ]]
then
backend=$2
else
backend="false"
fi
elif [[ "$1" =~ ^[0-9]+$ ]]
then
PORT=$1
if [[ "$2" == "" ]]
then
envfile=".env.standalone"
backend="false"
elif [[ "$2" =~ ^(true|false)$ ]]
then
backend=$2
envfile=".env.standalone"
else
envfile=".env.$2"
if [[ "$3" == "" ]]
then
backend="false"
else
backend=$3
fi
fi
elif [[ "$1" =~ ^(true|false)$ ]]
then
backend=$1
envfile=".env.standalone"
else
envfile=".env.$1"
backend="false"
runtype="command"
command="$1"
if [[ "$2" == "" ]]
then
envfile=".env.standalone"
else
envfile=".env.$2"
fi
fi
#cp .env.server .env
set -a
source $envfile
if [[ "$runtype" == "command" ]]
then
backend="false"
echo "envfile=${envfile}"
else
if [[ "$PORT" == "" ]]
then
PORT=8060
fi
echo "port=${PORT}, backend=${backend}, envfile=${envfile}"
fi
if [[ "$backend" =~ ^true$ ]]
then
if [[ "$envfile" == ".env.standalone" ]]
then
echo 'Running auth2 server in background'
else
echo 'Running auth2 cluster in background'
fi
export SYNC_MODE=True
poetry run gunicorn authome.wsgi --bind=:$PORT --config=gunicorn-dev.py >./logs/auth2_${PORT}.log 2>&1 &
#poetry run python manage.py runserver 0.0.0.0:$PORT >./logs/auth2_${PORT}.log 2>&1 &
pid=$!
echo ${pid} > ./logs/auth2_${PORT}.pid
elif [[ "$runtype" == "command" ]]
then
export SYNC_MODE=False
if [[ "$envfile" == ".env.standalone" ]]
then
echo 'Running auth2 shell in foreground'
else
echo 'Running auth2 cluster shell in foreground'
fi
poetry run python manage.py $command
else
if [[ "$envfile" == ".env.standalone" ]]
then
echo 'Running auth2 server in foreground'
else
echo 'Running auth2 cluster in foreground'
fi
export SYNC_MODE=False
poetry run python manage.py runserver 0.0.0.0:$PORT
fi