From 4bf86d4cf5b3641fb37013165442cb0f5e3ab591 Mon Sep 17 00:00:00 2001
From: William Pitcock <nenolod@dereferenced.org>
Date: Sat, 31 Mar 2018 23:43:03 +0000
Subject: [PATCH] config: make the upload limit configurable

---
 config/config.exs           | 1 +
 lib/pleroma/web/endpoint.ex | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/config/config.exs b/config/config.exs
index 151c6b826..cf8d6c2b7 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -49,6 +49,7 @@
   name: "Pleroma",
   email: "example@example.com",
   limit: 5000,
+  upload_limit: 16_000_000,
   registrations_open: true,
   federating: true
 
diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex
index 0a2ac853e..dde4e3ffe 100644
--- a/lib/pleroma/web/endpoint.ex
+++ b/lib/pleroma/web/endpoint.ex
@@ -34,7 +34,8 @@ defmodule Pleroma.Web.Endpoint do
     Plug.Parsers,
     parsers: [:urlencoded, :multipart, :json],
     pass: ["*/*"],
-    json_decoder: Jason
+    json_decoder: Jason,
+    length: Application.get_env(:pleroma, :instance) |> Keyword.get(:upload_limit)
   )
 
   plug(Plug.MethodOverride)