You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use conn.script_name instead of namespace to construct paths #12
I'm currently working on a similar "embed into some phoenix/plug app" tool than this one. In my research I found in bamboos preview router that they use conn.script_name to construct their routes. It would be nice to use this here as well, so the namespace option is no longer needed.
I wasn't familiar with conn.script_name, but it looks a bit magical and not well documented.
Looking at the code, it seems to be set in plug and phoenix when forwarding in the router, but I can't tell whether it should be considered a private detail.
Not really. I've looked at when it was introduces, and it seems to be there since Plug.Conn became a struct (basically forever). A quick look just now also suggests the route helpers of phoenix router do use the field, so I'd expect it's fine to be used for that job.
Activity
tompave commentedon Jun 23, 2019
Hi, thank you for the suggestion.
I wasn't familiar with
conn.script_name, but it looks a bit magical and not well documented.Looking at the code, it seems to be set in
plugandphoenixwhen forwarding in the router, but I can't tell whether it should be considered a private detail.Do you have more info?
LostKobrakai commentedon Jun 23, 2019
Not really. I've looked at when it was introduces, and it seems to be there since
Plug.Connbecame a struct (basically forever). A quick look just now also suggests the route helpers of phoenix router do use the field, so I'd expect it's fine to be used for that job.tompave commentedon Jun 23, 2019
Ok, I see. Then I'd be happy to accept a PR for this, if you want to give it a go.
The main requirement is that the dashboard should still work in three cases: embedded in Phoenix, embedded in another Plug router, and standalone.