Skip to content

Commit e6c4f4a

Browse files
committed
Update frontend_server.py
1 parent c1259ab commit e6c4f4a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/frontend_react/frontend_server.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import html
12
import os
23

34
import uvicorn
@@ -36,8 +37,12 @@ async def serve_index():
3637

3738
@app.get("/config")
3839
async def get_config():
40+
backend_url = html.escape(os.getenv("BACKEND_API_URL", "http://localhost:8000"))
41+
auth_enabled = html.escape(os.getenv("AUTH_ENABLED", "false"))
42+
backend_url = backend_url + "/api"
43+
3944
config = {
40-
"API_URL": os.getenv("API_URL", "API_URL not set"),
45+
"API_URL": backend_url,
4146
"REACT_APP_MSAL_AUTH_CLIENTID": os.getenv(
4247
"REACT_APP_MSAL_AUTH_CLIENTID", "Client ID not set"
4348
),
@@ -50,7 +55,7 @@ async def get_config():
5055
"REACT_APP_MSAL_POST_REDIRECT_URL": os.getenv(
5156
"REACT_APP_MSAL_POST_REDIRECT_URL", "Post Redirect URL not set"
5257
),
53-
"ENABLE_AUTH": os.getenv("ENABLE_AUTH", "false"),
58+
"ENABLE_AUTH": auth_enabled,
5459
}
5560
return config
5661

0 commit comments

Comments
 (0)