better config reading

This commit is contained in:
hakabahitoyo 2018-11-17 18:14:42 +09:00
parent 55abd8482e
commit 8fd0556c78
2 changed files with 6 additions and 5 deletions

View 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"

View 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)