From 6337c56c943953b6a2dca325fb4ee4f64909d21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szajbe?= Date: Thu, 3 Jul 2025 18:22:43 +0200 Subject: [PATCH] Use runtime config for assets --- lib/absinthe/plug/graphiql.ex | 1 - lib/absinthe/plug/graphiql/assets.ex | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/absinthe/plug/graphiql.ex b/lib/absinthe/plug/graphiql.ex index 561e74d..175a955 100644 --- a/lib/absinthe/plug/graphiql.ex +++ b/lib/absinthe/plug/graphiql.ex @@ -163,7 +163,6 @@ defmodule Absinthe.Plug.GraphiQL do interface: :playground | :advanced | :simple, default_headers: {module, atom}, default_url: binary, - assets: Keyword.t(), socket: module, socket_url: binary ] diff --git a/lib/absinthe/plug/graphiql/assets.ex b/lib/absinthe/plug/graphiql/assets.ex index d670797..01af162 100644 --- a/lib/absinthe/plug/graphiql/assets.ex +++ b/lib/absinthe/plug/graphiql/assets.ex @@ -2,7 +2,6 @@ defmodule Absinthe.Plug.GraphiQL.Assets do @moduledoc """ """ - @config Application.compile_env(:absinthe_plug, Absinthe.Plug.GraphiQL) @default_config [ source: :smart, local_url_path: "/absinthe_graphiql", @@ -72,10 +71,13 @@ defmodule Absinthe.Plug.GraphiQL.Assets do ]} ] - if @config do - def assets_config, do: Keyword.merge(@default_config, Keyword.get(config, :assets, [])) - else - def assets_config, do: @default_config + def assets_config do + runtime_config = + :absinthe_plug + |> Application.get_env(Absinthe.Plug.GraphiQL, []) + |> Keyword.get(:assets, []) + + Keyword.merge(@default_config, runtime_config) end def get_assets do