Giter Site home page Giter Site logo

Comments (5)

benwilson512 avatar benwilson512 commented on June 13, 2024 2

I think we should allow this to be set via Absinthe.Plug.put_options/2 in a higher up plug, it generalizes a lot better. Currently we enable this with a few options https://github.com/absinthe-graphql/absinthe_plug/blob/v1.5.2/lib/absinthe/plug.ex#L301 but we should generalize this to all of the options.

from absinthe_plug.

binaryseed avatar binaryseed commented on June 13, 2024 1

We do something similar to this with a custom plug that delegates to Absinthe.Plug, but it's an interesting idea. What do you think @benwilson512 ?

from absinthe_plug.

benwilson512 avatar benwilson512 commented on June 13, 2024 1

In the short term @paulstatezny you can wrap Absinthe.Plug:

defmodule MyAbsinthePlug do

  defdelegate init(opts), to: Absinthe.Plug

  def call(conn, opts) do
    complexity = complexity_for_current_user(conn)
    opts = Map.put(opts, :complexity, complexity)

    Absinthe.Plug.call(conn, opts)
  end
end

from absinthe_plug.

binaryseed avatar binaryseed commented on June 13, 2024 1

Opened a PR for this #243

from absinthe_plug.

paulstatezny avatar paulstatezny commented on June 13, 2024

Thanks for such a quick and helpful reply! ❤️

from absinthe_plug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.