projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
differences_in_mastoapi_responses: Update account fields
[akkoma]
/
lib
/
pleroma
/
config
/
transfer_task.ex
diff --git
a/lib/pleroma/config/transfer_task.ex
b/lib/pleroma/config/transfer_task.ex
index 3871e1cbb3fa075d619bebadf45a082ef050ee01..eb86b8ff490d8126a520ab9396bcb5f999493be8 100644
(file)
--- a/
lib/pleroma/config/transfer_task.ex
+++ b/
lib/pleroma/config/transfer_task.ex
@@
-28,10
+28,6
@@
defmodule Pleroma.Config.TransferTask do
{:pleroma, Pleroma.Captcha, [:seconds_valid]},
{:pleroma, Pleroma.Upload, [:proxy_remote]},
{:pleroma, :instance, [:upload_limit]},
{:pleroma, Pleroma.Captcha, [:seconds_valid]},
{:pleroma, Pleroma.Upload, [:proxy_remote]},
{:pleroma, :instance, [:upload_limit]},
- {:pleroma, :email_notifications, [:digest]},
- {:pleroma, :oauth2, [:clean_expired_tokens]},
- {:pleroma, Pleroma.ActivityExpiration, [:enabled]},
- {:pleroma, Pleroma.ScheduledActivity, [:enabled]},
{:pleroma, :gopher, [:enabled]}
]
{:pleroma, :gopher, [:enabled]}
]
@@
-46,17
+42,9
@@
defmodule Pleroma.Config.TransferTask do
with {_, true} <- {:configurable, Config.get(:configurable_from_database)} do
# We need to restart applications for loaded settings take effect
with {_, true} <- {:configurable, Config.get(:configurable_from_database)} do
# We need to restart applications for loaded settings take effect
- # TODO: some problem with prometheus after restart!
- reject_restart =
- if restart_pleroma? do
- [nil, :prometheus]
- else
- [:pleroma, nil, :prometheus]
- end
-
{logger, other} =
(Repo.all(ConfigDB) ++ deleted_settings)
{logger, other} =
(Repo.all(ConfigDB) ++ deleted_settings)
- |> Enum.map(&
transform_and_merge
/1)
+ |> Enum.map(&
merge_with_default
/1)
|> Enum.split_with(fn {group, _, _, _} -> group in [:logger, :quack] end)
logger
|> Enum.split_with(fn {group, _, _, _} -> group in [:logger, :quack] end)
logger
@@
-65,10
+53,20
@@
defmodule Pleroma.Config.TransferTask do
started_applications = Application.started_applications()
started_applications = Application.started_applications()
+ # TODO: some problem with prometheus after restart!
+ reject = [nil, :prometheus, :postgrex]
+
+ reject =
+ if restart_pleroma? do
+ reject
+ else
+ [:pleroma | reject]
+ end
+
other
|> Enum.map(&update/1)
|> Enum.uniq()
other
|> Enum.map(&update/1)
|> Enum.uniq()
- |> Enum.reject(&(&1 in reject
_restart
))
+ |> Enum.reject(&(&1 in reject))
|> maybe_set_pleroma_last()
|> Enum.each(&restart(started_applications, &1, Config.get(:env)))
|> maybe_set_pleroma_last()
|> Enum.each(&restart(started_applications, &1, Config.get(:env)))
@@
-90,11
+88,7
@@
defmodule Pleroma.Config.TransferTask do
end
end
end
end
- defp transform_and_merge(%{group: group, key: key, value: value} = setting) do
- group = ConfigDB.from_string(group)
- key = ConfigDB.from_string(key)
- value = ConfigDB.from_binary(value)
-
+ defp merge_with_default(%{group: group, key: key, value: value} = setting) do
default = Config.Holder.default_config(group, key)
merged =
default = Config.Holder.default_config(group, key)
merged =
@@
-122,7
+116,7
@@
defmodule Pleroma.Config.TransferTask do
:ok = update_env(:logger, :backends, merged)
end
:ok = update_env(:logger, :backends, merged)
end
- defp configure({
group, key, _, merged})
do
+ defp configure({
_, key, _, merged}) when key in [:console, :ex_syslogger]
do
merged =
if key == :console do
put_in(merged[:format], merged[:format] <> "\n")
merged =
if key == :console do
put_in(merged[:format], merged[:format] <> "\n")
@@
-136,7
+130,12
@@
defmodule Pleroma.Config.TransferTask do
else: key
Logger.configure_backend(backend, merged)
else: key
Logger.configure_backend(backend, merged)
- :ok = update_env(:logger, group, merged)
+ :ok = update_env(:logger, key, merged)
+ end
+
+ defp configure({_, key, _, merged}) do
+ Logger.configure([{key, merged}])
+ :ok = update_env(:logger, key, merged)
end
defp update({group, key, value, merged}) do
end
defp update({group, key, value, merged}) do