Code Monkey home page Code Monkey logo

Comments (3)

mschae avatar mschae commented on July 20, 2024 1

Doteki looks awesome but I think including another lib into this is overkill, sorry.

The {:system, value} approach would be ok for me but it does add overhead. I'll do a little benchmarking, given how fast Elixir does functions I'm pretty confident it will be negligible.

I still like the function-based approach: That function is only called once rather than on every call to plug. This has the benefit that when using ENV variables, we only do an ETS lookup (wich is comparably expensive) only once rather than with every call to plug.

I'm very performance-conscious because plugs have to be as fast as they possibly can. Hope that makes sense.

from cors_plug.

fpalluel avatar fpalluel commented on July 20, 2024

Hello,
The {:system, "VALUE"} workaround has the advantage of being simple and wide spread. Moreover, some projects, such as https://github.com/botsunit/doteki greatly enhance it (handling of other types than binaries (integers, atoms, lists), ability to use functions as variables...)

from cors_plug.

fpalluel avatar fpalluel commented on July 20, 2024

No problem !
Completely agree with the critical importance of plugs' performances.
Corsica makes use of functions too, to handle dynamic allowed origins...

from cors_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.