diff --git a/config/config.exs b/config/config.exs index bbf3d2072..a0176a72d 100644 --- a/config/config.exs +++ b/config/config.exs @@ -163,11 +163,6 @@ format: "$metadata[$level] $message", metadata: [:request_id] -config :quack, - level: :warn, - meta: [:all], - webhook_url: "https://hooks.slack.com/services/YOUR-KEY-HERE" - config :mime, :types, %{ "application/xml" => ["xml"], "application/xrd+xml" => ["xrd+xml"], diff --git a/config/description.exs b/config/description.exs index a6b7231d0..4d4306fba 100644 --- a/config/description.exs +++ b/config/description.exs @@ -1118,45 +1118,6 @@ } ] }, - %{ - group: :quack, - type: :group, - label: "Quack Logger", - description: "Quack-related settings", - children: [ - %{ - key: :level, - type: {:dropdown, :atom}, - description: "Log level", - suggestions: [:debug, :info, :warn, :error] - }, - %{ - key: :meta, - type: {:list, :atom}, - description: "Configure which metadata you want to report on", - suggestions: [ - :application, - :module, - :file, - :function, - :line, - :pid, - :crash_reason, - :initial_call, - :registered_name, - :all, - :none - ] - }, - %{ - key: :webhook_url, - label: "Webhook URL", - type: :string, - description: "Configure the Slack incoming webhook", - suggestions: ["https://hooks.slack.com/services/YOUR-KEY-HERE"] - } - ] - }, %{ group: :pleroma, key: :frontend_configurations, diff --git a/docs/docs/configuration/cheatsheet.md b/docs/docs/configuration/cheatsheet.md index b956d26e4..d81275043 100644 --- a/docs/docs/configuration/cheatsheet.md +++ b/docs/docs/configuration/cheatsheet.md @@ -785,17 +785,8 @@ config :logger, :ex_syslogger, level: :info, ident: "pleroma", format: "$metadata[$level] $message" - -config :quack, - level: :warn, - meta: [:all], - webhook_url: "https://hooks.slack.com/services/YOUR-API-KEY-HERE" ``` -See the [Quack Github](https://github.com/azohra/quack) for more details - - - ## Database options ### RUM indexing for full text search diff --git a/docs/docs/development/API/admin_api.md b/docs/docs/development/API/admin_api.md index 241e0b95c..211b5e736 100644 --- a/docs/docs/development/API/admin_api.md +++ b/docs/docs/development/API/admin_api.md @@ -1063,7 +1063,6 @@ List of settings which support only full update by key: ```elixir @full_key_update [ {:pleroma, :ecto_repos}, - {:quack, :meta}, {:mime, :types}, {:cors_plug, [:max_age, :methods, :expose, :headers]}, {:auto_linker, :opts}, @@ -1083,22 +1082,6 @@ List of settings which support only full update by subkey: ] ``` -*Settings without explicit key must be sended in separate config object params.* -```elixir -config :quack, - level: :debug, - meta: [:all], - ... -``` -```json -{ - "configs": [ - {"group": ":quack", "key": ":level", "value": ":debug"}, - {"group": ":quack", "key": ":meta", "value": [":all"]}, - ... - ] -} -``` - Request: ```json diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index c213f3ce6..33dc925bb 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -181,7 +181,8 @@ def warn do check_uploders_s3_public_endpoint(), check_quarantined_instances_tuples(), check_transparency_exclusions_tuples(), - check_simple_policy_tuples() + check_simple_policy_tuples(), + check_http_adapter() ] |> Enum.reduce(:ok, fn :ok, :ok -> :ok @@ -210,6 +211,26 @@ def check_welcome_message_config do end end + def check_http_adapter do + http_adapter = Application.get_env(:tesla, :adapter) + case http_adapter do + {Tesla.Adapter.Finch, _} -> + :ok + + _anything_else -> + Logger.error(""" + !!!CONFIG ERROR!!! + Your config is using a custom tesla adapter, this was standardised + to finch in 2022.06, and alternate adapters were removed in 2023.02. + Please ensure you either: + \n* do not have any custom value for `:tesla, :adapter`, or + \n* have `config :tesla, :adapter, {Tesla.Adapter.Finch, name: MyFinch}` + """) + + :error + end + end + def check_old_mrf_config do warning_preface = """ !!!DEPRECATION WARNING!!! diff --git a/lib/pleroma/config/transfer_task.ex b/lib/pleroma/config/transfer_task.ex index 81dc847cf..2e4bcb0ee 100644 --- a/lib/pleroma/config/transfer_task.ex +++ b/lib/pleroma/config/transfer_task.ex @@ -41,7 +41,7 @@ def load_and_update_env(deleted_settings \\ [], restart_pleroma? \\ true) do {logger, other} = (Repo.all(ConfigDB) ++ deleted_settings) |> Enum.map(&merge_with_default/1) - |> Enum.split_with(fn {group, _, _, _} -> group in [:logger, :quack] end) + |> Enum.split_with(fn {group, _, _, _} -> group == :logger end) logger |> Enum.sort() @@ -101,12 +101,6 @@ defp merge_with_default(%{group: group, key: key, value: value} = setting) do {group, key, value, merged} end - # change logger configuration in runtime, without restart - defp configure({:quack, key, _, merged}) do - Logger.configure_backend(Quack.Logger, [{key, merged}]) - :ok = update_env(:quack, key, merged) - end - defp configure({_, :backends, _, merged}) do # removing current backends Enum.each(Application.get_env(:logger, :backends), &Logger.remove_backend/1) diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex index cb57673e3..77f2c4e2d 100644 --- a/lib/pleroma/config_db.ex +++ b/lib/pleroma/config_db.ex @@ -163,7 +163,6 @@ defp can_be_partially_updated?(%ConfigDB{} = config), do: not only_full_update?( defp only_full_update?(%ConfigDB{group: group, key: key}) do full_key_update = [ {:pleroma, :ecto_repos}, - {:quack, :meta}, {:mime, :types}, {:cors_plug, [:max_age, :methods, :expose, :headers]}, {:swarm, :node_blacklist}, diff --git a/mix.exs b/mix.exs index 64f96b29c..299d2ad01 100644 --- a/mix.exs +++ b/mix.exs @@ -76,7 +76,6 @@ def application do :logger, :runtime_tools, :comeonin, - :quack, :fast_sanitize, :os_mon, :ssl @@ -164,7 +163,6 @@ defp deps do {:telemetry, "~> 0.3"}, {:poolboy, "~> 1.5"}, {:recon, "~> 2.5"}, - {:quack, "~> 0.1.1"}, {:joken, "~> 2.0"}, {:benchee, "~> 1.0"}, {:pot, "~> 1.0"}, diff --git a/test/fixtures/config/temp.secret.exs b/test/fixtures/config/temp.secret.exs index 9c5c88d98..3a8673679 100644 --- a/test/fixtures/config/temp.secret.exs +++ b/test/fixtures/config/temp.secret.exs @@ -8,8 +8,6 @@ config :pleroma, :second_setting, key: "value2", key2: ["Activity"] -config :quack, level: :info - config :pleroma, Pleroma.Repo, pool: Ecto.Adapters.SQL.Sandbox config :postgrex, :json_library, Poison diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs index d5e038bee..15ffe0ce6 100644 --- a/test/mix/tasks/pleroma/config_test.exs +++ b/test/mix/tasks/pleroma/config_test.exs @@ -49,7 +49,6 @@ test "error if file with custom settings doesn't exist" do describe "migrate_to_db/1" do setup do clear_config(:configurable_from_database, true) - clear_config([:quack, :level]) end @tag capture_log: true @@ -72,14 +71,12 @@ test "filtered settings are migrated to db" do config1 = ConfigDB.get_by_params(%{group: ":pleroma", key: ":first_setting"}) config2 = ConfigDB.get_by_params(%{group: ":pleroma", key: ":second_setting"}) - config3 = ConfigDB.get_by_params(%{group: ":quack", key: ":level"}) refute ConfigDB.get_by_params(%{group: ":pleroma", key: "Pleroma.Repo"}) refute ConfigDB.get_by_params(%{group: ":postgrex", key: ":json_library"}) refute ConfigDB.get_by_params(%{group: ":pleroma", key: ":database"}) assert config1.value == [key: "value", key2: [Repo]] assert config2.value == [key: "value2", key2: ["Activity"]] - assert config3.value == :info end test "config table is truncated before migration" do @@ -108,7 +105,6 @@ test "config table is truncated before migration" do test "settings are migrated to file and deleted from db", %{temp_file: temp_file} do insert_config_record(:pleroma, :setting_first, key: "value", key2: ["Activity"]) insert_config_record(:pleroma, :setting_second, key: "value2", key2: [Repo]) - insert_config_record(:quack, :level, :info) MixTask.run(["migrate_from_db", "--env", "temp", "-d"]) @@ -117,7 +113,6 @@ test "settings are migrated to file and deleted from db", %{temp_file: temp_file file = File.read!(temp_file) assert file =~ "config :pleroma, :setting_first," assert file =~ "config :pleroma, :setting_second," - assert file =~ "config :quack, :level, :info" end test "load a settings with large values and pass to file", %{temp_file: temp_file} do @@ -198,7 +193,6 @@ test "load a settings with large values and pass to file", %{temp_file: temp_fil setup do insert_config_record(:pleroma, :setting_first, key: "value", key2: ["Activity"]) insert_config_record(:pleroma, :setting_second, key: "value2", key2: [Repo]) - insert_config_record(:quack, :level, :info) path = "test/instance_static" file_path = Path.join(path, "temp.exported_from_db.secret.exs") @@ -214,7 +208,6 @@ test "with path parameter", %{file_path: file_path} do file = File.read!(file_path) assert file =~ "config :pleroma, :setting_first," assert file =~ "config :pleroma, :setting_second," - assert file =~ "config :quack, :level, :info" end test "release", %{file_path: file_path} do @@ -226,7 +219,6 @@ test "release", %{file_path: file_path} do file = File.read!(file_path) assert file =~ "config :pleroma, :setting_first," assert file =~ "config :pleroma, :setting_second," - assert file =~ "config :quack, :level, :info" end end diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index 053e28207..a56601896 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -279,4 +279,12 @@ test "check_uploders_s3_public_endpoint/0" do end) =~ "Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket." end + + test "check_http_adapter/0" do + clear_config([:tesla, :adapter], Gun) + + assert capture_log(fn -> + DeprecationWarnings.check_http_adapter() + end) =~ "Your config is using a custom tesla adapter" + end end diff --git a/test/pleroma/config/loader_test.exs b/test/pleroma/config/loader_test.exs index b34fd70da..cef66748f 100644 --- a/test/pleroma/config/loader_test.exs +++ b/test/pleroma/config/loader_test.exs @@ -11,7 +11,6 @@ test "read/1" do config = Loader.read("test/fixtures/config/temp.secret.exs") assert config[:pleroma][:first_setting][:key] == "value" assert config[:pleroma][:first_setting][:key2] == [Pleroma.Repo] - assert config[:quack][:level] == :info end test "filter_group/2" do diff --git a/test/pleroma/config/transfer_task_test.exs b/test/pleroma/config/transfer_task_test.exs index 988214eb1..6491d10fb 100644 --- a/test/pleroma/config/transfer_task_test.exs +++ b/test/pleroma/config/transfer_task_test.exs @@ -17,14 +17,12 @@ defmodule Pleroma.Config.TransferTaskTest do test "transfer config values from db to env" do refute Application.get_env(:pleroma, :test_key) refute Application.get_env(:idna, :test_key) - refute Application.get_env(:quack, :test_key) refute Application.get_env(:postgrex, :test_key) initial = Application.get_env(:logger, :level) insert(:config, key: :test_key, value: [live: 2, com: 3]) insert(:config, group: :idna, key: :test_key, value: [live: 15, com: 35]) - insert(:config, group: :quack, key: :test_key, value: [:test_value1, :test_value2]) insert(:config, group: :postgrex, key: :test_key, value: :value) insert(:config, group: :logger, key: :level, value: :debug) insert(:config, group: :pleroma, key: :instance, value: [static_dir: "static_dir_from_db"]) @@ -32,7 +30,6 @@ test "transfer config values from db to env" do assert Application.get_env(:pleroma, :test_key) == [live: 2, com: 3] assert Application.get_env(:idna, :test_key) == [live: 15, com: 35] - assert Application.get_env(:quack, :test_key) == [:test_value1, :test_value2] assert Application.get_env(:logger, :level) == :debug assert Application.get_env(:postgrex, :test_key) == :value assert Application.get_env(:pleroma, :instance)[:static_dir] == "static_dir_from_db" @@ -40,7 +37,6 @@ test "transfer config values from db to env" do on_exit(fn -> Application.delete_env(:pleroma, :test_key) Application.delete_env(:idna, :test_key) - Application.delete_env(:quack, :test_key) Application.delete_env(:postgrex, :test_key) Application.put_env(:logger, :level, initial) System.delete_env("RELEASE_NAME") @@ -82,26 +78,6 @@ test "transfer task falls back to release defaults if no other values found" do end) end - test "transfer config values for 1 group and some keys" do - level = Application.get_env(:quack, :level) - meta = Application.get_env(:quack, :meta) - - insert(:config, group: :quack, key: :level, value: :info) - insert(:config, group: :quack, key: :meta, value: [:none]) - - TransferTask.start_link([]) - - assert Application.get_env(:quack, :level) == :info - assert Application.get_env(:quack, :meta) == [:none] - default = Pleroma.Config.Holder.default_config(:quack, :webhook_url) - assert Application.get_env(:quack, :webhook_url) == default - - on_exit(fn -> - Application.put_env(:quack, :level, level) - Application.put_env(:quack, :meta, meta) - end) - end - test "transfer config values with full subkey update" do clear_config(:emoji) clear_config(:assets) diff --git a/test/pleroma/config_db_test.exs b/test/pleroma/config_db_test.exs index d42123fb4..e68346ce4 100644 --- a/test/pleroma/config_db_test.exs +++ b/test/pleroma/config_db_test.exs @@ -14,28 +14,6 @@ test "get_by_params/1" do assert config == ConfigDB.get_by_params(%{group: config.group, key: config.key}) end - test "get_all_as_keyword/0" do - saved = insert(:config) - insert(:config, group: ":quack", key: ":level", value: :info) - insert(:config, group: ":quack", key: ":meta", value: [:none]) - - insert(:config, - group: ":quack", - key: ":webhook_url", - value: "https://hooks.slack.com/services/KEY/some_val" - ) - - config = ConfigDB.get_all_as_keyword() - - assert config[:pleroma] == [ - {saved.key, saved.value} - ] - - assert config[:quack][:level] == :info - assert config[:quack][:meta] == [:none] - assert config[:quack][:webhook_url] == "https://hooks.slack.com/services/KEY/some_val" - end - describe "update_or_create/1" do test "common" do config = insert(:config) diff --git a/test/support/cluster.ex b/test/support/cluster.ex index 524194cf4..7e41631c5 100644 --- a/test/support/cluster.ex +++ b/test/support/cluster.ex @@ -96,7 +96,7 @@ def spawn_cluster(node_configs) do silence_logger_warnings(fn -> node_configs - |> Enum.map(&Task.async(fn -> start_slave(&1) end)) + |> Enum.map(&Task.async(fn -> start_peer(&1) end)) |> Enum.map(&Task.await(&1, 90_000)) end) end @@ -121,9 +121,9 @@ def eval_quoted(block, binding) do result end - defp start_slave({node_host, override_configs}) do + defp start_peer({node_host, override_configs}) do log(node_host, "booting federated VM") - {:ok, node} = :slave.start(~c"127.0.0.1", node_name(node_host), vm_args()) + {:ok, node} = :peer.start(%{host: ~c"127.0.0.1", name: node_name(node_host), args: vm_args()}) add_code_paths(node) load_apps_and_transfer_configuration(node, override_configs) ensure_apps_started(node)