Skip to content

Use runtime config for assets#305

Open
szajbus wants to merge 1 commit intoabsinthe-graphql:mainfrom
knowtrex:main
Open

Use runtime config for assets#305
szajbus wants to merge 1 commit intoabsinthe-graphql:mainfrom
knowtrex:main

Conversation

@szajbus
Copy link

@szajbus szajbus commented Jul 3, 2025

Summary of the PR:

  • Use runtime config instead of compile time

The main use case for providing runtime config is to override local_directory option when using Elixir releases:

# config/runtime.exs
config :absinthe_plug, Absinthe.Plug.GraphiQL,
    assets: [
      source: :smart,
      local_url_path: "/absinthe_graphiql",
      local_directory: Path.join(Application.app_dir(:my_app), "priv/static/absinthe_graphiql")
    ]

The above is a method to use patched version of @absinthe/socket dependency which fixes the missing headers bug (see absinthe-graphql/absinthe-socket#67)

As far as I know this cannot be achieved using compile-time configuration, because Application.app_dir(:my_app) is not available at that time. Besides, compile-time configuration didn't work anyway - it was inducing a compilation error.

  • Remove assets option from plug's init/1 type specification, because it was not used there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants