better config reading
authorhakabahitoyo <hakabahitoyo@example.com>
Sat, 17 Nov 2018 09:14:42 +0000 (18:14 +0900)
committerhakabahitoyo <hakabahitoyo@example.com>
Sat, 17 Nov 2018 09:14:42 +0000 (18:14 +0900)
config/config.exs
lib/pleroma/uploaders/mdii.ex

index 8ce443f9e1a919ab6366e4db21d494fce58292b1..af0fdca9aae4d79745df95b405f91bedde938000 100644 (file)
@@ -23,7 +23,7 @@ config :pleroma, Pleroma.Uploaders.S3,
   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"
 
index c62bab07768493b1104b5141f32f231b6ce26248..b0c7e19e798fa90f2bacaef4480baf4747caf407 100644 (file)
@@ -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)