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;")
)
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 ->