- if Pleroma.Config.get([:instance, :dynamic_configuration]) do
- Pleroma.Repo.all(Config)
- |> Enum.each(&update_env(&1))
+ if Pleroma.Config.get([:instance, :dynamic_configuration]) and
+ Ecto.Adapters.SQL.table_exists?(Pleroma.Repo, "config") do
+ for_restart =
+ Pleroma.Repo.all(Config)
+ |> Enum.map(&update_env(&1))
+
+ # We need to restart applications for loaded settings take effect
+ for_restart
+ |> Enum.reject(&(&1 in [:pleroma, :ok]))
+ |> Enum.each(fn app ->
+ Application.stop(app)
+ :ok = Application.start(app)
+ end)