Skip to content

Conversation

@robotrapta
Copy link
Member

@robotrapta robotrapta commented Mar 13, 2023

Automatically corrects common mistakes when setting the endpoint URL. Specifically, if you just put a hostname without a path, like https://api.groundlight.ai it will work properly now (automatically adding /device-api). It corrects for trailing slash on the URL. And warns for URL patterns it doesn't recognize.

Copy link
Contributor

@michael-groundlight michael-groundlight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! This is helpful

if parts.path not in ("/device-api/", "/v1/", "/v2/", "/v3/"):
logger.warning(f"Configured endpoint {endpoint} does not look right - path '{parts.path}' seems wrong.")
out = urlunsplit(parts)
out = out[:-1] # remove trailing slash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log.debug() the sanitized endpoint?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to move away from the idea that customers specify /device-api because it's kinda confusing. So I kinda don't even want to expose it in debug logs.

@robotrapta robotrapta merged commit d9a0084 into main Mar 16, 2023
@robotrapta robotrapta deleted the endpoints-robust branch March 16, 2023 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants