X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fmix%2Ftasks%2Fpleroma%2Fconfig.ex;h=f657adf4600f7fae031d85f00d5985f4c38213f4;hb=6334ba9ad3d275e9e50b30319e2dbed3aac35fac;hp=7ab15e60be07708271a4a9b93868763ec94977e3;hpb=4bdfcf1682f1429e72102bf9f54ddee9e7ede0bc;p=akkoma diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index 7ab15e60b..f657adf46 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -99,37 +99,18 @@ defmodule Mix.Tasks.Pleroma.Config do end end - def run(["keys", group]) do + def run(["reset"]) do with true <- Pleroma.Config.get([:configurable_from_database]) do start_pleroma() - group = maybe_atomize(group) - - keys = - ConfigDB - |> Repo.all() - |> Enum.map(fn x -> - if x.group == group do - x.key - end - end) - |> Enum.sort() - |> Enum.uniq() - |> Enum.reject(fn x -> x == nil end) + shell_info("The following settings will be permanently removed:") - if length(keys) > 0 do - shell_info("The following configuration keys under :#{group} are set in ConfigDB:\r\n") - keys |> Enum.each(fn x -> shell_info("- #{x}") end) - shell_info("\r\n") - end - else - _ -> configdb_not_enabled() - end - end + ConfigDB + |> Repo.all() + |> Enum.sort() + |> Enum.each(&dump(&1)) - def run(["reset"]) do - with true <- Pleroma.Config.get([:configurable_from_database]) do - start_pleroma() + shell_error("\nTHIS CANNOT BE UNDONE!") if shell_prompt("Are you sure you want to continue?", "n") in ~w(Yn Y y) do Ecto.Adapters.SQL.query!(Repo, "TRUNCATE config;") @@ -337,7 +318,7 @@ defmodule Mix.Tasks.Pleroma.Config do ) end - defp dump_key(group, key) when is_atom(group) and is_atom(key) do + defp dump_key(group, key) when is_atom(group) and is_atom(key) do ConfigDB |> Repo.all() |> Enum.filter(fn x ->