plug(
OAuthScopesPlug,
%{scopes: ["read"], admin: true}
- when action in [:config_show, :migrate_to_db, :migrate_from_db, :list_log]
+ when action in [:config_show, :migrate_from_db, :list_log]
)
plug(
end
def migrate_from_db(conn, _params) do
- with :ok <- check_dynamic_configuration(conn) do
+ with :ok <- configurable_from_database(conn) do
Mix.Tasks.Pleroma.Config.run([
"migrate_from_db",
"--env",
end
def config_show(conn, _params) do
- with :ok <- check_dynamic_configuration(conn) do
+ with :ok <- configurable_from_database(conn) do
configs = Pleroma.Repo.all(Config)
if configs == [] do
- errors(conn, {:error, "To use dynamic configuration migrate your settings to database."})
+ errors(
+ conn,
+ {:error, "To use configuration from database migrate your settings to database."}
+ )
else
conn
|> put_view(ConfigView)
end
def config_update(conn, %{"configs" => configs}) do
- with :ok <- check_dynamic_configuration(conn) do
+ with :ok <- configurable_from_database(conn) do
updated =
Enum.map(configs, fn
%{"group" => group, "key" => key, "delete" => true} = params ->
end
end
- defp check_dynamic_configuration(conn) do
- if Pleroma.Config.get([:instance, :dynamic_configuration]) do
+ defp configurable_from_database(conn) do
+ if Pleroma.Config.get(:configurable_from_database) do
:ok
else
- errors(conn, {:error, "To use this endpoint you need to enable dynamic configuration."})
+ errors(
+ conn,
+ {:error, "To use this endpoint you need to enable configuration from database."}
+ )
end
end