Skip to content
Snippets Groups Projects
Verified Commit 754deb26 authored by Haelwenn's avatar Haelwenn
Browse files

[Pleroma.Uploaders.Local]: Add configuration for custom url path

One use-case being an external caching proxy
parent b7923aa3
Branches feature/custom_media_url
No related tags found
No related merge requests found
......@@ -14,7 +14,9 @@ config :pleroma, Pleroma.Upload,
uploader: Pleroma.Uploaders.Local,
strip_exif: false
config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
config :pleroma, Pleroma.Uploaders.Local,
uploads: "uploads",
uploads_url: "{{base_url}}/media/{{file}}"
config :pleroma, Pleroma.Uploaders.S3,
bucket: nil,
......
......@@ -42,6 +42,10 @@ defmodule Pleroma.Uploaders.Local do
end
defp url_for(file) do
"#{Web.base_url()}/media/#{file}"
settings = Application.get_env(:pleroma, Pleroma.Uploaders.Local)
Keyword.get(settings, :uploads_url)
|> String.replace("{{file}}", file)
|> String.replace("{{base_url}}", Web.base_url())
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment