Coder Social home page Coder Social logo

Comments (6)

pintsized avatar pintsized commented on July 17, 2024

Currently (because we haven't refactored yet based on the outcome of discussions on #11), this isn't possible. But with the suggested mechanism in #11, all options will actually be stored within the ngx.ctx table. This means that they are relevant to the current request only, and this is also true of sub-requests.. which have their own ngx.ctx space.

So in principle, when the new config mechanism is working (soon!), you can have different origin_location or redis_host options for requests and sub-requests.

Does that sound like what you need?

from ledge.

bakins avatar bakins commented on July 17, 2024

For now, yes. I'd like to help out if I can.

from ledge.

pintsized avatar pintsized commented on July 17, 2024

Cool, nice one. I'm in the middle of working on refactoring the config stuff, so I'll get something committed soon.. feedback will be most welcome :)

In general, this whole project is in flux right now, as you will have gathered, but it's starting to make some sense. Do feel free to send pull requests and generally request / discuss features on here. Hopefully it'll be a little less fragile in the coming weeks..

from ledge.

pintsized avatar pintsized commented on July 17, 2024

I've just committed a first pass of this.. So you can now do something like:

http {
    init_by_lua '
        rack = require "resty.rack"
        ledge = require "ledge.ledge"
        ledge.gset("origin_location", "/__ledge/example.com")
        ledge.gset("redis_host", 192.168.1.234)
    ';

    server {
        location / {
            content_by_lua '
                rack.use(ledge)
                rack.run()
            ';
        }
    }
}

from ledge.

pintsized avatar pintsized commented on July 17, 2024

I should add that ledge.gset("cache_key_spec", table) isn't supported. Need to think about that a bit.

from ledge.

pintsized avatar pintsized commented on July 17, 2024

I've sent a pull request to lua-nginx-module which adds ngx.get_phase() to the API. When this is released, we'll drop ledge.gset(). So config parameters can be set either globally during init_by_lua or per-location, both using the uniform ledge.set().

from ledge.

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.