From 9cee307e3a2a358734c1d0fb867efc338a52cda8 Mon Sep 17 00:00:00 2001 From: Arjun Satarkar Date: Sat, 27 Jul 2024 23:14:54 +0530 Subject: Don't use Application.compile_env Everything should be runtime config. --- lib/mediasync/http_errors.ex | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/mediasync/http_errors.ex b/lib/mediasync/http_errors.ex index cbbb613..5df85fd 100644 --- a/lib/mediasync/http_errors.ex +++ b/lib/mediasync/http_errors.ex @@ -2,14 +2,6 @@ defmodule Mediasync.HTTPErrors do import Plug.Conn import Mediasync.Utils - @video_url_too_large Jason.encode!( - %{ - "error" => "videoUrlTooLarge", - "maxSize" => Application.compile_env(:mediasync, :max_video_url_size) - }, - pretty: true - ) - @spec send_video_url_too_large(Plug.Conn.t()) :: Plug.Conn.t() @spec send_video_url_too_large(Plug.Conn.t(), []) :: Plug.Conn.t() def send_video_url_too_large(conn, _opts \\ []) do @@ -17,7 +9,13 @@ defmodule Mediasync.HTTPErrors do |> put_json_content_type() |> send_resp( 400, - @video_url_too_large + Jason.encode!( + %{ + "error" => "videoUrlTooLarge", + "maxSize" => Application.fetch_env!(:mediasync, :max_video_url_size) + }, + pretty: true + ) ) end -- cgit v1.2.3-57-g22cb