From f9514b08f2ec486df23e2cdb400a1c9c3a11e549 Mon Sep 17 00:00:00 2001 From: Lady Lumb <42786600+LadyLumb@users.noreply.github.com> Date: Fri, 31 May 2019 01:57:08 -0700 Subject: [PATCH] Added env variables for max image and video size. 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 65f00e1c866..70a671b4a96 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -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