From 6b3c2e7ac751136c749d86655b3b116b148ff329 Mon Sep 17 00:00:00 2001 From: Vidminas Mikucionis <5411598+Vidminas@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:03:12 +0000 Subject: [PATCH] Get oauth callback uri from env --- chat_app/main.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/chat_app/main.py b/chat_app/main.py index 73ed1a6..24dddd1 100644 --- a/chat_app/main.py +++ b/chat_app/main.py @@ -6,8 +6,11 @@ from langchain.schema import messages_to_dict from chat_app.solid_message_history import SolidChatMessageHistory - -OAUTH_CALLBACK_URI = "http://localhost:8501/callback" +hostname = os.environ.get("WEBSITE_HOSTNAME") +if hostname is not None: + OAUTH_CALLBACK_URI = f"https://{hostname}/callback" +else: + OAUTH_CALLBACK_URI = "http://localhost:8501/callback" def setup_login_sidebar(): @@ -104,12 +107,6 @@ def main(): st.sidebar.title("Options") setup_login_sidebar() - st.text("WEBSITE_SITE_NAME", help=os.environ.get("WEBSITE_SITE_NAME")) - st.text("WEBSITE_HOSTNAME", help=os.environ.get("WEBSITE_HOSTNAME")) - st.text("SERVER_PORT", help=os.environ.get("SERVER_PORT")) - st.text("PORT", help=os.environ.get("PORT")) - st.text("WEBSITES_PORT", help=os.environ.get("WEBSITES_PORT")) - if "solid_token" in st.session_state: if "msg_history" not in st.session_state: st.session_state["msg_history"] = SolidChatMessageHistory(