Skip to content

Commit

Permalink
Reverts hack to callback_url (#169)
Browse files Browse the repository at this point in the history
That removed staging
  • Loading branch information
markwaddle authored Oct 25, 2024
1 parent 8e0bbf0 commit 72001ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,20 @@ def __init__(
async def lifespan() -> AsyncIterator[None]:
# connect to workbench on startup
logger.info(
"connecting to semantic-workbench-service on startup; workbench_service_url: %s",
"connecting to semantic-workbench-service on startup; workbench_service_url: %s, assistant_service_id: %s, callback_url: %s",
settings.workbench_service_url,
self.service_id,
settings.callback_url,
)

async with self.workbench_client.for_service() as service_client:
try:
await self._ping_semantic_workbench(service_client)
logger.info(
"connected to semantic-workbench-service on startup; workbench_service_url: %s",
"connected to semantic-workbench-service on startup; workbench_service_url: %s, assistant_service_id: %s, callback_url: %s",
settings.workbench_service_url,
self.service_id,
settings.callback_url,
)
except httpx.HTTPError:
logger.warning("failed to connect workbench on startup", exc_info=True)
Expand Down Expand Up @@ -149,16 +153,18 @@ async def _ping_semantic_workbench(self, client: workbench_service_client.Assist
logger.warning(
"authentication failed with semantic-workbench service, configured assistant_service_id and/or"
" workbench_service_api_key are incorrect; workbench_service_url: %s,"
" assistant_service_id: %s",
" assistant_service_id: %s, callback_url: %s",
settings.workbench_service_url,
self.service_id,
settings.callback_url,
)
case 404:
logger.warning(
"configured assistant_service_id does not exist in the semantic-workbench-service;"
" workbench_service_url: %s, assistant_service_id: %s",
" workbench_service_url: %s, assistant_service_id: %s, callback_url: %s",
settings.workbench_service_url,
self.service_id,
settings.callback_url,
)
raise

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ class Settings(BaseSettings):
def callback_url(self) -> str:
# use config from Azure App Service if available
if self.website_hostname:
# small hack to always use the non-staging hostname in the callback url
hostname = self.website_hostname.replace("-staging", "")
url = f"{self.website_protocol}://{hostname}"
url = f"{self.website_protocol}://{self.website_hostname}"
if self.website_port is None:
return url
return f"{url}:{self.website_port}"
Expand Down

0 comments on commit 72001ba

Please sign in to comment.