Fix show_toolbar_with_docker on runtimes with unrelated host address - #2422
Conversation
show_toolbar_with_docker derived the Docker host address by resolving host.docker.internal and replacing the last segment with .1. Runtimes such as OrbStack resolve that name to an address outside the container network (0.250.250.254), so the derived address never matches REMOTE_ADDR and the toolbar stays hidden. Fall back to deriving the gateway from the container's own addresses when the host.docker.internal probe does not match. Closes django-commons#2419
|
I tweaked the solution to be more amenable to follow-up docker tests. If this new check fails, it shouldn't automatically return false. It ideally should fall through to the last return false statement. |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
tim-schilling
left a comment
There was a problem hiding this comment.
Can you round out the tests to have coverage of the missing lines identified here: #2422 (comment)?
|
Let's also update the documentation warning around docker with a note to include something like:
|
|
Added that note to the Docker warning in
Thanks for the fall-through rework, that reads better than the nested version I had. |
|
As I went to merge it I got cold-feet that someone could use this improperly. However, the check on |
|
Thank you @tim-schilling and @Sanjays2402! |
Description
show_toolbar_with_dockerderives the Docker host address by resolvinghost.docker.internaland replacing the last segment with.1. On OrbStackthat name resolves to
0.250.250.254, which is outside the container network,so the derived address never matches
REMOTE_ADDRand the toolbar stayshidden. When that probe does not match, the host address is now derived from
the container's own addresses instead.
Fixes #2419
Checklist:
docs/changes.rst.AI/LLM Usage