Reconfigure plug at runtime with env

Closes #1165

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-10-06 08:59:50 +02:00
parent 0265e0220e
commit c080795955
4 changed files with 19 additions and 8 deletions

14
lib/web/plug_configs.ex Normal file
View File

@@ -0,0 +1,14 @@
defmodule Mobilizon.Web.PlugConfigs do
@moduledoc """
Runtime configuration for plugs
"""
def parsers do
upload_limit =
Keyword.get(Application.get_env(:mobilizon, :instance, []), :upload_limit, 10_485_760)
[
parsers: [:urlencoded, {:multipart, length: upload_limit}, :json, Absinthe.Plug.Parser]
]
end
end