projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Webfinger: Handle bogus ids better.
[akkoma]
/
lib
/
pleroma
/
config
/
transfer_task.ex
diff --git
a/lib/pleroma/config/transfer_task.ex
b/lib/pleroma/config/transfer_task.ex
index f4722f99d36acc510163779241f39f7e230dcec2..a0d7b7d71b7952f7fadfc8f2b7c799f7bbea9394 100644
(file)
--- a/
lib/pleroma/config/transfer_task.ex
+++ b/
lib/pleroma/config/transfer_task.ex
@@
-28,15
+28,11
@@
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]}
]
- def start_link(
_
) do
- load_and_update_env()
+ def start_link(
restart_pleroma? \\ true
) do
+ load_and_update_env(
[], restart_pleroma?
)
if Config.get(:env) == :test, do: Ecto.Adapters.SQL.Sandbox.checkin(Repo)
:ignore
end
if Config.get(:env) == :test, do: Ecto.Adapters.SQL.Sandbox.checkin(Repo)
:ignore
end
@@
-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 =