From 16512acc3ba77716e13ae8c8fd9b001d53001013 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Thu, 17 Aug 2023 11:41:55 +0100 Subject: [PATCH] Add warning for config that probably shouldn't be in the DB --- CHANGELOG.md | 3 +++ lib/mix/tasks/pleroma/config.ex | 3 +++ lib/pleroma/config/transfer_task.ex | 1 + 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71949e2e4..1bbb382ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Added - Full compatibility with Erlang OTP26 - handling of GET /api/v1/preferences +- Explicit listing of config keys that are allowed to be set by the database + - Previously set config keys will still be loaded, but you will get a warning + that they probably should not be dynamically configured. ## Changed - OTP builds are now built on erlang OTP26 diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index 5aac1cb39..5c163a81f 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -319,6 +319,9 @@ defmodule Mix.Tasks.Pleroma.Config do defp create(group, settings) do group |> Pleroma.Config.Loader.filter_group(settings) + |> Enum.filter(fn {key, _value} -> + Pleroma.Config.ConfigurableFromDatabase.whitelisted_config?(group, key) + end) |> Enum.each(fn {key, value} -> {:ok, _} = ConfigDB.update_or_create(%{group: group, key: key, value: value}) diff --git a/lib/pleroma/config/transfer_task.ex b/lib/pleroma/config/transfer_task.ex index 0a55aab3c..1c182ebee 100644 --- a/lib/pleroma/config/transfer_task.ex +++ b/lib/pleroma/config/transfer_task.ex @@ -100,6 +100,7 @@ defmodule Pleroma.Config.TransferTask do MIX: mix pleroma.config delete #{group} #{key} OTP: ./bin/pleroma_ctl config delete #{group} #{key} and setting it in your .exs file instead + config #{inspect(group)}, #{inspect(key)}, #{inspect(value)} ]) end