From 8fd0556c78472f8bdeee3520d6192ce96339d545 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sat, 17 Nov 2018 18:14:42 +0900 Subject: [PATCH] better config reading --- config/config.exs | 2 +- lib/pleroma/uploaders/mdii.ex | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/config.exs b/config/config.exs index 8ce443f9e..af0fdca9a 100644 --- a/config/config.exs +++ b/config/config.exs @@ -23,7 +23,7 @@ public_endpoint: "https://s3.amazonaws.com", force_media_proxy: false -config :pleroma, Pleroma.Uploaders.Mdii, +config :pleroma, Pleroma.Uploaders.MDII, cgi: "https://mdii.sakura.ne.jp/mdii-post.cgi", files: "https://mdii.sakura.ne.jp" diff --git a/lib/pleroma/uploaders/mdii.ex b/lib/pleroma/uploaders/mdii.ex index c62bab077..b0c7e19e7 100644 --- a/lib/pleroma/uploaders/mdii.ex +++ b/lib/pleroma/uploaders/mdii.ex @@ -1,12 +1,13 @@ -defmodule Pleroma.Uploaders.Mdii do +defmodule Pleroma.Uploaders.MDII do + alias Pleroma.Config + @behaviour Pleroma.Uploaders.Uploader @httpoison Application.get_env(:pleroma, :httpoison) def put_file(name, uuid, path, content_type, _should_dedupe) do - settings = Application.get_env(:pleroma, Pleroma.Uploaders.Mdii) - cgi = Keyword.fetch!(settings, :cgi) - files = Keyword.fetch!(settings, :files) + cgi = Pleroma.Config.get([Pleroma.Uploaders.MDII, :cgi]) + files = Pleroma.Config.get([Pleroma.Uploaders.MDII, :files]) {:ok, file_data} = File.read(path)