fix(backend): fix config cache not being used everytime

When loading a page, we inject various meta tags in the HTML. These made database calls everytime

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-08-17 13:16:58 +02:00
parent a6721ec4ae
commit ed3cd5858c
4 changed files with 100 additions and 64 deletions

View File

@@ -78,6 +78,11 @@ defmodule Mobilizon.Admin do
defp stringify_struct(struct), do: struct
@spec get_all_admin_settings :: list(Setting.t())
def get_all_admin_settings do
Repo.all(Setting)
end
@spec get_admin_setting_value(String.t(), String.t(), String.t() | nil) ::
String.t() | boolean() | nil | map() | list()
def get_admin_setting_value(group, name, fallback \\ nil)