Skip to content

Commit 982b15f

Browse files
committed
(feat) improve conditions
1 parent a19b87d commit 982b15f

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

frontend/st_utils.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,16 @@ def style_metric_cards(
7373

7474
def get_backend_api_client():
7575
from backend.services.backend_api_client import BackendAPIClient
76-
from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
77-
is_docker_running = False
76+
from CONFIG import BACKEND_API_HOST, BACKEND_API_PASSWORD, BACKEND_API_PORT, BACKEND_API_USERNAME
7877
try:
79-
backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT)
80-
is_docker_running = backend_api_client.is_docker_running()
81-
except Exception as e:
82-
st.error(
83-
f"There was an error trying to connect to the Backend API. Please make sure the Backend API is running.\n\n"
84-
f"Error: \n\n{str(e)}")
78+
backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT,
79+
username=BACKEND_API_USERNAME, password=BACKEND_API_PASSWORD)
80+
if not backend_api_client.is_docker_running():
81+
st.error("Docker is not running. Please make sure Docker is running.")
82+
st.stop()
83+
return backend_api_client
84+
except Exception:
8585
st.stop()
86-
if not is_docker_running:
87-
st.error("Docker is not running. Please make sure Docker is running.")
88-
st.stop()
89-
return backend_api_client
9086

9187

9288
def auth_system():
@@ -102,7 +98,6 @@ def auth_system():
10298
config['cookie']['name'],
10399
config['cookie']['key'],
104100
config['cookie']['expiry_days'],
105-
config['pre-authorized']
106101
)
107102
show_pages(main_page() + public_pages())
108103
st.session_state.authenticator.login()

0 commit comments

Comments
 (0)