Hey,
is there a way to configure Plug.Static
at runtime (right after boot)?
I have a usecase where the location of the files and the desired request path (:from
and :at
options) is only known after startup.
Hey,
is there a way to configure Plug.Static
at runtime (right after boot)?
I have a usecase where the location of the files and the desired request path (:from
and :at
options) is only known after startup.
This is going to be complicated because Plug.Static
uses pattern matching to only match against particular from
/ at
values. I guess you could write a custom plug that makes its decisions dynamically and eat the performance loss.
Performance is not a big deal here. So I might look into building my own version of Plug.Static
.
EDIT: Seems like it would be enough to create a wrapper plug that calls Plug.Static.call/2
with the conn and the dynamically created options.