Phillipp
Configure Plug.Static at runtime
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.
Marked As Solved
evadne
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.
Also Liked
Phillipp
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.
Last Post!
LostKobrakai
I’m wondering if you called Plug.Static.init/1 still. The opts for call/2 are not always the same data passed on the plug call.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










