fix(api): emulator proxy client uri logic #12778
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The emulator proxy was failing when calling
socket.gethostname()
when the proxy was not running inside of Docker.It was fixed to be hard-coded to
127.0.0.1
but this brokeopentrons-emulation
's usage of the proxy.To fix, added
use_local_host
flag toProxySettings
. This flag is defaulted toTrue
.When set to
True
the emulator proxy defaults to using127.0.0.1
as its host name.When set to
False
it callssocket.gethostname()
and it's internal IP address inside of the Docker networkWhen running the proxy outside of Docker this flag does not need to be changed.
But when running inside of Docker (i.e. opentrons-emulation) it needs to be set to
False
.Test Plan
OT_EMULATOR_use_local_host="False"
Review requests
No
Risk assessment
Low, not changing any major functionality. Just adding a simple conditional, whose default value only breaks emulation. Therefore, since I am the main dev for emulation, that's on me to handle.