user agent if Endpoint is not started yet

This commit is contained in:
Alexander Strizhakov 2020-09-02 15:45:47 +03:00
parent 47ff425cfd
commit a11f23c130
No known key found for this signature in database
GPG key ID: 022896A53AEF1381

View file

@ -22,13 +22,18 @@ def named_version, do: @name <> " " <> @version
def repository, do: @repository
def user_agent do
case Config.get([:http, :user_agent], :default) do
:default ->
info = "#{Pleroma.Web.base_url()} <#{Config.get([:instance, :email], "")}>"
named_version() <> "; " <> info
if Process.whereis(Pleroma.Web.Endpoint) do
case Config.get([:http, :user_agent], :default) do
:default ->
info = "#{Pleroma.Web.base_url()} <#{Config.get([:instance, :email], "")}>"
named_version() <> "; " <> info
custom ->
custom
custom ->
custom
end
else
# fallback, if endpoint is not started yet
"Pleroma Data Loader"
end
end