]> cat aescling's git repositories - mastodon.git/commitdiff
Added env variables for max image and video size.
authorLady Lumb <42786600+LadyLumb@users.noreply.github.com>
Fri, 31 May 2019 08:57:08 +0000 (01:57 -0700)
committerThibG <thib@sitedethib.com>
Sun, 2 Jun 2019 12:38:13 +0000 (14:38 +0200)
I changed the IMAGE_LIMIT and VIDEO_LIMIT variables to read from the env, or use default if not set in the env, to make it easier to change this on an instance by instance basis and make it persistent across updates.

app/models/media_attachment.rb

index 65f00e1c866df6404179c52dd745c025472e39d7..70a671b4a96bfc9477f959fab65016029dca6ef4 100644 (file)
@@ -101,8 +101,8 @@ class MediaAttachment < ApplicationRecord
     },
   }.freeze
 
-  IMAGE_LIMIT = 8.megabytes
-  VIDEO_LIMIT = 40.megabytes
+  IMAGE_LIMIT = (ENV['MAX_IMAGE_SIZE'] || 8.megabytes).to_i
+  VIDEO_LIMIT = (ENV['MAX_VIDEO_SIZE'] || 40.megabytes).to_i
 
   belongs_to :account,          inverse_of: :media_attachments, optional: true
   belongs_to :status,           inverse_of: :media_attachments, optional: true