Remove unnecessary keys command
[akkoma] / lib / mix / tasks / pleroma / config.ex
index 7ab15e60be07708271a4a9b93868763ec94977e3..f657adf4600f7fae031d85f00d5985f4c38213f4 100644 (file)
@@ -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 ->