forked from feathr-ai/feathr
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·68 lines (59 loc) · 2.3 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·68 lines (59 loc) · 2.3 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
#!/bin/bash
# Generate static env.config.js for UI app
envfile=/usr/share/nginx/html/env-config.js
echo "window.environment = {" > $envfile
if [[ -z "${REACT_APP_AZURE_CLIENT_ID}" ]]; then
echo "Environment variable REACT_APP_AZURE_CLIENT_ID is not defined, skipping"
else
echo " \"azureClientId\": \"${REACT_APP_AZURE_CLIENT_ID}\"," >> $envfile
fi
if [[ -z "${REACT_APP_AZURE_TENANT_ID}" ]]; then
echo "Environment variable REACT_APP_AZURE_TENANT_ID is not defined, skipping"
else
echo " \"azureTenantId\": \"${REACT_APP_AZURE_TENANT_ID}\"," >> $envfile
fi
if [[ -z "${REACT_APP_ENABLE_RBAC}" ]]; then
echo "Environment variable REACT_APP_ENABLE_RBAC is not defined, skipping"
else
echo " \"enableRBAC\": \"${REACT_APP_ENABLE_RBAC}\"," >> $envfile
fi
echo "}" >> $envfile
echo "Successfully generated ${envfile} with following content"
cat $envfile
# Start nginx
nginx
# Start API app
LISTENING_PORT="8000"
if [ "x$REACT_APP_ENABLE_RBAC" == "x" ]; then
echo "RBAC flag not configured, only launch registry app"
if [ "x$PURVIEW_NAME" == "x" ]; then
echo "Purview flag is not configured, run SQL registry"
cd sql-registry
uvicorn main:app --host 0.0.0.0 --port $LISTENING_PORT
else
echo "Purview flag is configured, run Purview registry"
cd purview-registry
uvicorn main:app --host 0.0.0.0 --port $LISTENING_PORT
fi
else
echo "RBAC flag configured, launch both rbac and reigstry apps"
if [ "x$PURVIEW_NAME" == "x" ]; then
echo "Purview flag is not configured, run SQL registry"
cd sql-registry
nohup uvicorn main:app --host 0.0.0.0 --port 18000 &
else
echo "Purview flag is configured, run Purview registry"
cd purview-registry
nohup uvicorn main:app --host 0.0.0.0 --port 18000 &
fi
echo "Run rbac app"
cd ../access_control
export RBAC_REGISTRY_URL="http://127.0.0.1:18000/api/v1"
export RBAC_API_BASE="${API_BASE}"
export RBAC_AAD_INSTANCE="https://login.microsoftonline.com"
export RBAC_API_CLIENT_ID="${REACT_APP_AZURE_CLIENT_ID}"
export RBAC_AAD_TENANT_ID="${REACT_APP_AZURE_TENANT_ID}"
export RBAC_API_AUDIENCE="${REACT_APP_AZURE_CLIENT_ID}"
export RBAC_CONNECTION_STR="${CONNECTION_STR}"
uvicorn main:app --host 0.0.0.0 --port $LISTENING_PORT
fi