Merge branch 'deprecate-public_endpoint' into 'develop'
authorfeld <feld@feld.me>
Wed, 20 Jan 2021 22:48:48 +0000 (22:48 +0000)
committerfeld <feld@feld.me>
Wed, 20 Jan 2021 22:48:48 +0000 (22:48 +0000)
Deprecate Uploaders.S3, :public_endpoint

See merge request pleroma/pleroma!3251

13 files changed:
1  2 
CHANGELOG.md
config/config.exs
config/test.exs
lib/pleroma/config/deprecation_warnings.ex
lib/pleroma/upload.ex
test/pleroma/config/deprecation_warnings_test.exs
test/pleroma/object_test.exs
test/pleroma/scheduled_activity_test.exs
test/pleroma/upload_test.exs
test/pleroma/uploaders/s3_test.exs
test/pleroma/user/backup_test.exs
test/support/data_case.ex
test/support/helpers.ex

diff --combined CHANGELOG.md
index 8080c63f5784e17de5c2cd55875232918418bc4a,31d6a75613ce263cc414667b26502928116a7f09..76eab51d437c9ba2e53029c4e20a79c0d823e50a
@@@ -8,15 -8,14 +8,16 @@@ The format is based on [Keep a Changelo
  
  ### Changed
  
 +- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
 +- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed`
 +- **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved`
  - Polls now always return a `voters_count`, even if they are single-choice.
  - Admin Emails: The ap id is used as the user link in emails now.
  - Improved registration workflow for email confirmation and account approval modes.
 -- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
  - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries.
  - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators.
  - Admin API: Reports now ordered by newest
+ - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders.
  
  ### Added
  
@@@ -42,7 -41,6 +43,7 @@@
  - Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute.
  - Admin API: An endpoint to manage frontends.
  - Streaming API: Add follow relationships updates.
 +- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types
  </details>
  
  ### Fixed
@@@ -50,7 -48,6 +51,7 @@@
  - Users with `is_discoverable` field set to false (default value) will appear in in-service search results but be hidden from external services (search bots etc.).
  - Streaming API: Posts and notifications are not dropped, when CLI task is executing.
  - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers.
 +- Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private.
  
  <details>
    <summary>API Changes</summary>
  
  ## Unreleased (Patch)
  
 +
 +## [2.2.2] - 2020-01-18
 +
  ### Fixed
  
 -- Fix ability to update Pleroma Chat push notifications with PUT /api/v1/push/subscription and alert type pleroma:chat_mention
 -- Emoji Reaction activity filtering from blocked and muted accounts.
  - StealEmojiPolicy creates dir for emojis, if it doesn't exist.
 +- Updated `elixir_make` to a non-retired version
 +
 +### Upgrade notes
 +
 +1. Restart Pleroma
  
  ## [2.2.1] - 2020-12-22
  
@@@ -86,7 -77,6 +87,7 @@@
  - Rich Media Previews sometimes showed the wrong preview due to a bug following redirects.
  - Fixes for the autolinker.
  - Forwarded reports duplication from Pleroma instances.
 +- Emoji Reaction activity filtering from blocked and muted accounts.
  
  - <details>
      <summary>API</summary>
diff --combined config/config.exs
index db45f7a3d83aeeac1242f9e8accf50769964b614,dc5964fc904a0739cc184bd14dd349a5ffc6b4eb..70d0c2c2ba0734ea283cd8341e582d6ae948f428
@@@ -64,14 -64,23 +64,23 @@@ config :pleroma, Pleroma.Upload
    link_name: false,
    proxy_remote: false,
    filename_display_max_length: 30,
-   default_description: nil
+   default_description: nil,
+   base_url: nil
  
  config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
  
  config :pleroma, Pleroma.Uploaders.S3,
    bucket: nil,
-   streaming_enabled: true,
-   public_endpoint: "https://s3.amazonaws.com"
+   bucket_namespace: nil,
+   truncated_namespace: nil,
+   streaming_enabled: true
+ config :ex_aws, :s3,
+   # host: "s3.wasabisys.com", # required if not Amazon AWS
+   access_key_id: nil,
+   secret_access_key: nil,
+   # region: "us-east-1", # may be required for Amazon AWS
+   scheme: "https://"
  
  config :pleroma, :emoji,
    shortcode_globs: ["/emoji/custom/**/*.png"],
@@@ -542,7 -551,7 +551,7 @@@ config :pleroma, Oban
      scheduled_activities: 10,
      background: 5,
      remote_fetcher: 2,
 -    attachments_cleanup: 5,
 +    attachments_cleanup: 1,
      new_users_digest: 1,
      mute_expire: 5
    ],
diff --combined config/test.exs
index 6f6b18558a0fa27d63dccbb49c87ebf85b879ff6,76c7a2c670ee4ed5795198f710405e7b36657dde..690c98e40e909b6b3ff4aaa8f85f655f9727c5df
@@@ -53,7 -53,7 +53,7 @@@ config :pleroma, Pleroma.Repo
  config :pleroma, :dangerzone, override_repo_pool_size: true
  
  # Reduce hash rounds for testing
 -config :pbkdf2_elixir, rounds: 1
 +config :pleroma, :password, iterations: 1
  
  config :tesla, adapter: Tesla.Mock
  
@@@ -115,11 -115,6 +115,6 @@@ config :pleroma, Pleroma.Web.Plugs.Remo
  
  config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true
  
- config :pleroma, Pleroma.Uploaders.S3,
-   bucket: nil,
-   streaming_enabled: true,
-   public_endpoint: nil
  config :tzdata, :autoupdate, :disabled
  
  config :pleroma, :mrf, policies: []
index 382076c31e05cd5945af68a0f16a4cadcdd93910,703a5273fc2d00b3c18550fc881c51ef0ad5c40f..24aa5993bae0aefd1201c8d6daea8bcf47f31565
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.Config.DeprecationWarnings do
@@@ -40,7 -40,8 +40,8 @@@
           :ok <- check_welcome_message_config(),
           :ok <- check_gun_pool_options(),
           :ok <- check_activity_expiration_config(),
-          :ok <- check_remote_ip_plug_name() do
+          :ok <- check_remote_ip_plug_name(),
+          :ok <- check_uploders_s3_public_endpoint() do
        :ok
      else
        _ ->
        warning_preface
      )
    end
+   @spec check_uploders_s3_public_endpoint() :: :ok | nil
+   def check_uploders_s3_public_endpoint do
+     s3_config = Pleroma.Config.get([Pleroma.Uploaders.S3])
+     use_old_config = Keyword.has_key?(s3_config, :public_endpoint)
+     if use_old_config do
+       Logger.error("""
+       !!!DEPRECATION WARNING!!!
+       Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket.\n
+       Please make the following change at your earliest convenience.\n
+       \n* `config :pleroma, Pleroma.Uploaders.S3, public_endpoint` is now equal to:
+       \n* `config :pleroma, Pleroma.Upload, base_url`
+       """)
+       :error
+     else
+       :ok
+     end
+   end
  end
diff --combined lib/pleroma/upload.ex
index 00b61ca80230a2e65a57f416522ff9270365f220,e13d40c5a6e8c3c2188faccef7ed2dbb7e35c275..6547113514b15fe3d74770f2fde3869930265223
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.Upload do
        uploader: Keyword.get(opts, :uploader, Pleroma.Config.get([__MODULE__, :uploader])),
        filters: Keyword.get(opts, :filters, Pleroma.Config.get([__MODULE__, :filters])),
        description: Keyword.get(opts, :description),
-       base_url:
-         Keyword.get(
-           opts,
-           :base_url,
-           Pleroma.Config.get([__MODULE__, :base_url], Pleroma.Web.base_url())
-         )
+       base_url: base_url()
      }
    end
  
            ""
          end
  
-     prefix =
-       if is_nil(Pleroma.Config.get([__MODULE__, :base_url])) do
-         "media"
-       else
-         ""
-       end
-     [base_url, prefix, path]
+     [base_url, path]
      |> Path.join()
    end
  
  
        Pleroma.Uploaders.S3 ->
          bucket = Config.get([Pleroma.Uploaders.S3, :bucket])
+         truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace])
+         namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace])
  
          bucket_with_namespace =
            cond do
-             truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace]) ->
+             !is_nil(truncated_namespace) ->
                truncated_namespace
  
-             namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace]) ->
+             !is_nil(namespace) ->
                namespace <> ":" <> bucket
  
              true ->
          end
  
        _ ->
-         public_endpoint || upload_base_url
+         public_endpoint || upload_base_url || Pleroma.Web.base_url() <> "/media/"
      end
    end
  end
index 7dff935585fd3670df152382f2c44372b78d1f39,161bf6e9081ed5aa4c4d4d36b3368490b0ed8bf1..37e02fae20eb340c3ba46d83242c1de8908b7493
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.Config.DeprecationWarningsTest do
             end) =~ "Your config is using old namespace for activity expiration configuration."
    end
  
+   test "check_uploders_s3_public_endpoint/0" do
+     clear_config(Pleroma.Uploaders.S3, public_endpoint: "https://fake.amazonaws.com/bucket/")
+     assert capture_log(fn ->
+              DeprecationWarnings.check_uploders_s3_public_endpoint()
+            end) =~
+              "Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket."
+   end
    describe "check_gun_pool_options/0" do
      test "await_up_timeout" do
        config = Config.get(:connections_pool)
index 4a8d80fcce8b3e4af1bd5232a8319d1bcdcc3ca5,3150c8e01533fd65b7fb0ce43a0cf66c3a9434b0..db7678d5d183ce9ab41079792924fccefc6513b9
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.ObjectTest do
@@@ -78,8 -78,8 +78,8 @@@
      setup do: clear_config([:instance, :cleanup_attachments])
  
      test "Disabled via config" do
-       Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-       Pleroma.Config.put([:instance, :cleanup_attachments], false)
+       clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+       clear_config([:instance, :cleanup_attachments], false)
  
        file = %Plug.Upload{
          content_type: "image/jpeg",
      end
  
      test "in subdirectories" do
-       Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-       Pleroma.Config.put([:instance, :cleanup_attachments], true)
+       clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+       clear_config([:instance, :cleanup_attachments], true)
  
        file = %Plug.Upload{
          content_type: "image/jpeg",
      end
  
      test "with dedupe enabled" do
-       Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-       Pleroma.Config.put([Pleroma.Upload, :filters], [Pleroma.Upload.Filter.Dedupe])
-       Pleroma.Config.put([:instance, :cleanup_attachments], true)
+       clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+       clear_config([Pleroma.Upload, :filters], [Pleroma.Upload.Filter.Dedupe])
+       clear_config([:instance, :cleanup_attachments], true)
  
        uploads_dir = Pleroma.Config.get!([Pleroma.Uploaders.Local, :uploads])
  
      end
  
      test "with objects that have legacy data.url attribute" do
-       Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-       Pleroma.Config.put([:instance, :cleanup_attachments], true)
+       clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+       clear_config([:instance, :cleanup_attachments], true)
  
        file = %Plug.Upload{
          content_type: "image/jpeg",
      end
  
      test "With custom base_url" do
-       Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-       Pleroma.Config.put([Pleroma.Upload, :base_url], "https://sub.domain.tld/dir/")
-       Pleroma.Config.put([:instance, :cleanup_attachments], true)
+       clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+       clear_config([Pleroma.Upload, :base_url], "https://sub.domain.tld/dir/")
+       clear_config([:instance, :cleanup_attachments], true)
  
        file = %Plug.Upload{
          content_type: "image/jpeg",
index b84ddcb8e5bba4679efd2df2075c86c7c9f9b1da,902d1d99c3ad160e592d7b84390d4e60af960f33..10188d11690d7497fbcc019b9575b52bbfc5afa2
@@@ -1,18 -1,17 +1,17 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.ScheduledActivityTest do
    use Pleroma.DataCase
-   alias Pleroma.DataCase
    alias Pleroma.ScheduledActivity
    import Pleroma.Factory
  
    setup do: clear_config([ScheduledActivity, :enabled])
  
-   setup context do
-     DataCase.ensure_local_uploader(context)
-   end
+   setup [:ensure_local_uploader]
  
    describe "creation" do
      test "scheduled activities with jobs when ScheduledActivity enabled" do
index 8feb532d3528a02d4cfa9d40d214753a671a2f6a,8f84a0be173187f3e55c82ef7856dbbbd4869629..f1ab82a57441b00ad37ec8e8ffcb23504ece8719
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.UploadTest do
  
        assert %{"url" => [%{"href" => url}]} = data
  
-       assert String.starts_with?(url, Pleroma.Web.base_url() <> "/media/")
+       assert String.starts_with?(url, Pleroma.Upload.base_url())
      end
  
      test "copies the file to the configured folder with deduping" do
        {:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe])
  
        assert List.first(data["url"])["href"] ==
-                Pleroma.Web.base_url() <>
-                  "/media/e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg"
+                Pleroma.Upload.base_url() <>
+                  "e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg"
      end
  
      test "copies the file to the configured folder without deduping" do
index 9c937d2519faca9eadebd1e4357cb255f41a3dc1,9910525962c505dc68a49df81a0c051020141db7..709631a6a347aa94bd83d7d3b02a103d3a473c6d
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.Uploaders.S3Test do
    import ExUnit.CaptureLog
  
    setup do
-     clear_config(Pleroma.Upload,
-       uploader: Pleroma.Uploaders.S3
-     )
-     clear_config(Pleroma.Uploaders.S3,
-       bucket: "test_bucket",
-       public_endpoint: "https://s3.amazonaws.com"
-     )
+     clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3)
+     clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
+     clear_config([Pleroma.Uploaders.S3])
+     clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket")
    end
  
    describe "get_file/1" do
      test "it returns path without bucket when truncated_namespace set to ''" do
        Config.put([Pleroma.Uploaders.S3],
          bucket: "test_bucket",
-         public_endpoint: "https://s3.amazonaws.com",
+         bucket_namespace: "myaccount",
          truncated_namespace: ""
        )
  
+       Config.put([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
        assert S3.get_file("test_image.jpg") == {
                 :ok,
                 {:url, "https://s3.amazonaws.com/test_image.jpg"}
@@@ -46,7 -44,6 +44,6 @@@
      test "it returns path with bucket namespace when namespace is set" do
        Config.put([Pleroma.Uploaders.S3],
          bucket: "test_bucket",
-         public_endpoint: "https://s3.amazonaws.com",
          bucket_namespace: "family"
        )
  
index 7fb4c5fbe9eae59069982b4dcfd6eae44cf1f058,108928c09bb5246ec196404fc01e6bb6ebc06c74..1aab25ba6cd958debc1005174ae49c5469b9427e
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.User.BackupTest do
  
    describe "it uploads and deletes a backup archive" do
      setup do
-       clear_config(Pleroma.Uploaders.S3,
-         bucket: "test_bucket",
-         public_endpoint: "https://s3.amazonaws.com"
-       )
-       clear_config([Pleroma.Upload, :uploader])
+       clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
+       clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket")
  
        user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"})
  
      end
  
      test "S3", %{path: path, backup: backup} do
-       Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3)
+       clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3)
+       clear_config([Pleroma.Uploaders.S3, :streaming_enabled], false)
  
        with_mock ExAws,
          request: fn
          assert {:ok, %Pleroma.Upload{}} = Backup.upload(backup, path)
          assert {:ok, _backup} = Backup.delete(backup)
        end
-       with_mock ExAws, request: fn %{http_method: :delete} -> {:ok, %{status_code: 204}} end do
-       end
      end
  
      test "Local", %{path: path, backup: backup} do
-       Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+       clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
  
        assert {:ok, %Pleroma.Upload{}} = Backup.upload(backup, path)
        assert {:ok, _backup} = Backup.delete(backup)
index 9db3478bcbe11d9034a4aeac322a9918ff782c20,0427682a203873867734dddbb7e54af2bf587271..1f33450e63da80b466b6b3bfd7224e8753f1ae82
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.DataCase do
@@@ -18,6 -18,8 +18,8 @@@
  
    use ExUnit.CaseTemplate
  
+   import Pleroma.Tests.Helpers, only: [clear_config: 2]
    using do
      quote do
        alias Pleroma.Repo
    end
  
    def ensure_local_uploader(context) do
-     test_uploader = Map.get(context, :uploader, Pleroma.Uploaders.Local)
-     uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
-     filters = Pleroma.Config.get([Pleroma.Upload, :filters])
-     Pleroma.Config.put([Pleroma.Upload, :uploader], test_uploader)
-     Pleroma.Config.put([Pleroma.Upload, :filters], [])
+     test_uploader = Map.get(context, :uploader) || Pleroma.Uploaders.Local
  
-     on_exit(fn ->
-       Pleroma.Config.put([Pleroma.Upload, :uploader], uploader)
-       Pleroma.Config.put([Pleroma.Upload, :filters], filters)
-     end)
+     clear_config([Pleroma.Upload, :uploader], test_uploader)
+     clear_config([Pleroma.Upload, :filters], [])
  
      :ok
    end
diff --combined test/support/helpers.ex
index 4353d5254b84f78f76254d34a0bae849eccdad48,db38a1e817bb65fbff2bb9b20e44a5100949bffc..856a6a376f8865fa08be93448402adebd940f28c
@@@ -1,5 -1,5 +1,5 @@@
  # Pleroma: A lightweight social networking server
 -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
 +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  # SPDX-License-Identifier: AGPL-3.0-only
  
  defmodule Pleroma.Tests.Helpers do
@@@ -8,6 -8,8 +8,8 @@@
    """
    alias Pleroma.Config
  
+   require Logger
    defmacro clear_config(config_path) do
      quote do
        clear_config(unquote(config_path)) do
@@@ -18,6 -20,7 +20,7 @@@
    defmacro clear_config(config_path, do: yield) do
      quote do
        initial_setting = Config.fetch(unquote(config_path))
        unquote(yield)
  
        on_exit(fn ->
    end
  
    defmacro clear_config(config_path, temp_setting) do
+     # NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!)
+     # Displaying a warning to prevent unintentional clearing of all but one keys in section
+     if Keyword.keyword?(temp_setting) and length(temp_setting) == 1 do
+       Logger.warn(
+         "Please change to `clear_config([section]); clear_config([section, key], value)`: " <>
+           "#{inspect(config_path)}, #{inspect(temp_setting)}"
+       )
+     end
      quote do
        clear_config(unquote(config_path)) do
          Config.put(unquote(config_path), unquote(temp_setting))