diff options
author | href <href@random.sh> | 2018-11-06 19:34:57 +0100 |
---|---|---|
committer | href <href@random.sh> | 2018-11-06 19:41:15 +0100 |
commit | 5bb88fd1749931e755157760ec833c5d50ebb8c8 (patch) | |
tree | a43e1d2cb7812bd8df741203126e1ca12052c058 /lib/pleroma/upload.ex | |
parent | 25512aa29cae22b73ee45a22954693c1a130ea3e (diff) | |
download | pleroma-5bb88fd1749931e755157760ec833c5d50ebb8c8.tar.gz |
Runtime configuration
Related to #85
Everything should now be configured at runtime, with the exception of
the `Pleroma.HTML` scrubbers (the scrubbers used can be
changed at runtime, but their configuration is compile-time) because
it's building a module with a macro.
Diffstat (limited to 'lib/pleroma/upload.ex')
-rw-r--r-- | lib/pleroma/upload.ex | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 2293ff54e..89aa779f9 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -1,9 +1,6 @@ defmodule Pleroma.Upload do alias Ecto.UUID - @storage_backend Application.get_env(:pleroma, Pleroma.Upload) - |> Keyword.fetch!(:uploader) - def check_file_size(path, nil), do: true def check_file_size(path, size_limit) do @@ -21,8 +18,7 @@ defmodule Pleroma.Upload do true <- check_file_size(file.path, size_limit) do strip_exif_data(content_type, file.path) - {:ok, url_path} = - @storage_backend.put_file(name, uuid, file.path, content_type, should_dedupe) + {:ok, url_path} = uploader().put_file(name, uuid, file.path, content_type, should_dedupe) %{ "type" => "Document", @@ -57,8 +53,7 @@ defmodule Pleroma.Upload do content_type ) - {:ok, url_path} = - @storage_backend.put_file(name, uuid, tmp_path, content_type, should_dedupe) + {:ok, url_path} = uploader().put_file(name, uuid, tmp_path, content_type, should_dedupe) %{ "type" => "Image", @@ -182,4 +177,8 @@ defmodule Pleroma.Upload do _e -> "application/octet-stream" end end + + defp uploader() do + Pleroma.Config.get!([Pleroma.Upload, :uploader]) + end end |