From f984c45052589f58ad987b7c799bf8f793f24ed6 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Thu, 6 Feb 2025 16:00:33 +0000 Subject: [PATCH] add put_raw --- lib/config_settings/settings.ex | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/config_settings/settings.ex b/lib/config_settings/settings.ex index 956d15f..b21d391 100644 --- a/lib/config_settings/settings.ex +++ b/lib/config_settings/settings.ex @@ -436,8 +436,24 @@ defmodule Bonfire.Common.Settings do |> set_with_hooks(to_options(opts)) end + + def put_raw(key, value, opts), do: put_raw([key], value, opts) + + def put_raw(keys, value, opts \\ []) + + def put_raw(keys, value, opts) when is_list(keys) do + # keys = Config.keys_tree(keys) # Note: doing this in set/2 instead + # |> debug("Putting settings for") + Enums.map_put_in(keys, value) + |> debug("send to hooks") + # |> maybe_to_keyword_list(true) + # |> debug("maybe_to_keyword_list") + |> set_with_hooks(to_options(opts)) + end + def put(key, value, opts), do: put([key], value, opts) + def delete(key_tree, opts \\ []) def delete(key_tree, opts) when is_list(key_tree) do