Hello, I'm trying to know which port the service is listening to from the svc.on_startup hook, I've tried a number of things but none worked, any idea on how I could do that?
c
Chaoyu
04/06/2024, 10:47 PM
what’s the reason you need to know the port?
Chaoyu
04/06/2024, 10:47 PM
The default is 3000 but user can override that
v
Vivien Robert
04/08/2024, 8:16 AM
It's a bit of an edge case, I am trying to make an endpoint that returns an url to the service itself. (we're getting ip from env but it makes sense to get port from the process) I ended up grabbing it from the BentoMLContainer (which is an internal) as I couldn't get it with solutions recommended for uvicorn/starlette. I haven't tested yet that the one gotten from BentoMLContainer is always right in production but it was fine in my local tests.