projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '1031-parent-visible' into 'develop'
[akkoma]
/
lib
/
mix
/
tasks
/
pleroma
/
config.ex
diff --git
a/lib/mix/tasks/pleroma/config.ex
b/lib/mix/tasks/pleroma/config.ex
index 8098e9bab81cc5e5749da979d8738797ee5906a0..d5129d410b8c9cde9cc5b38208344b4e2a334c0a 100644
(file)
--- a/
lib/mix/tasks/pleroma/config.ex
+++ b/
lib/mix/tasks/pleroma/config.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Config do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Config do
@@
-52,7
+52,9
@@
defmodule Mix.Tasks.Pleroma.Config do
defp do_migrate_to_db(config_file) do
if File.exists?(config_file) do
defp do_migrate_to_db(config_file) do
if File.exists?(config_file) do
+ shell_info("Migrating settings from file: #{Path.expand(config_file)}")
Ecto.Adapters.SQL.query!(Repo, "TRUNCATE config;")
Ecto.Adapters.SQL.query!(Repo, "TRUNCATE config;")
+ Ecto.Adapters.SQL.query!(Repo, "ALTER SEQUENCE config_id_seq RESTART;")
custom_config =
config_file
custom_config =
config_file
@@
-71,8
+73,7
@@
defmodule Mix.Tasks.Pleroma.Config do
group
|> Pleroma.Config.Loader.filter_group(settings)
|> Enum.each(fn {key, value} ->
group
|> Pleroma.Config.Loader.filter_group(settings)
|> Enum.each(fn {key, value} ->
- key = inspect(key)
- {:ok, _} = ConfigDB.update_or_create(%{group: inspect(group), key: key, value: value})
+ {:ok, _} = ConfigDB.update_or_create(%{group: group, key: key, value: value})
shell_info("Settings for key #{key} migrated.")
end)
shell_info("Settings for key #{key} migrated.")
end)
@@
-130,12
+131,9
@@
defmodule Mix.Tasks.Pleroma.Config do
end
defp write(config, file) do
end
defp write(config, file) do
- value =
- config.value
- |> ConfigDB.from_binary()
- |> inspect(limit: :infinity)
+ value = inspect(config.value, limit: :infinity)
- IO.write(file, "config #{
config.group}, #{config.key
}, #{value}\r\n\r\n")
+ IO.write(file, "config #{
inspect(config.group)}, #{inspect(config.key)
}, #{value}\r\n\r\n")
config
end
config
end