# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Frontend do
require Logger
def install(name, opts \\ []) do
- cmd_frontend_info = %{
+ frontend_info = %{
"ref" => opts[:ref],
"build_url" => opts[:build_url],
"build_dir" => opts[:build_dir]
}
- config_frontend_info = Config.get([:frontends, :available, name], %{})
-
frontend_info =
- Map.merge(config_frontend_info, cmd_frontend_info, fn _key, config, cmd ->
+ [:frontends, :available, name]
+ |> Config.get(%{})
+ |> Map.merge(frontend_info, fn _key, config, cmd ->
# This only overrides things that are actually set
cmd || config
end)
else
{:download_or_unzip, _} ->
Logger.info("Could not download or unzip the frontend")
+ {:error, "Could not download or unzip the frontend"}
_e ->
Logger.info("Could not install the frontend")
+ {:error, "Could not install the frontend"}
end
end