diff options
author | Mark Felder <feld@FreeBSD.org> | 2020-09-17 09:32:50 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2020-09-17 09:32:50 -0500 |
commit | f7e40f7ef134a3030aa61114daa39810efb5889d (patch) | |
tree | 1ee1127690f922c26a144157f82064da2e401b50 /lib/mix/tasks | |
parent | 2a7c9ac14797000735283ef2cdf5cc2240402c41 (diff) | |
download | pleroma-f7e40f7ef134a3030aa61114daa39810efb5889d.tar.gz |
Deny ConfigDB migration when deprecated settings found
Diffstat (limited to 'lib/mix/tasks')
-rw-r--r-- | lib/mix/tasks/pleroma/config.ex | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index 904c5a74b..18f99318d 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -32,7 +32,8 @@ defmodule Mix.Tasks.Pleroma.Config do @spec migrate_to_db(Path.t() | nil) :: any() def migrate_to_db(file_path \\ nil) do - if Pleroma.Config.get([:configurable_from_database]) do + with true <- Pleroma.Config.get([:configurable_from_database]), + :ok <- Pleroma.Config.DeprecationWarnings.warn() do config_file = if file_path do file_path @@ -46,7 +47,8 @@ defmodule Mix.Tasks.Pleroma.Config do do_migrate_to_db(config_file) else - migration_error() + :error -> deprecation_error() + _ -> migration_error() end end @@ -120,6 +122,10 @@ defmodule Mix.Tasks.Pleroma.Config do ) end + defp deprecation_error do + shell_error("Migration is not allowed until all deprecation warnings have been resolved.") + end + if Code.ensure_loaded?(Config.Reader) do defp config_header, do: "import Config\r\n\r\n" defp read_file(config_file), do: Config.Reader.read_imports!(config_file) |