Coder Social home page Coder Social logo

Config mechanism is unclear about ledge HOT 4 CLOSED

ledgetech avatar ledgetech commented on July 17, 2024
Config mechanism is unclear

from ledge.

Comments (4)

pintsized avatar pintsized commented on July 17, 2024

It may be worth considering the following new feature, available in OpenResty 1.2.1.5:

feature: added new configure directives init_by_lua and
init_by_lua_file. they can be used to pre-load Lua modules,
register true Lua global variables, and initialize the
shared-memory storage defined via lua_shared_dict, at Nginx
config-loading time. thanks drdrxp for suggesting this new
feature.

from ledge.

bakins avatar bakins commented on July 17, 2024

Could all the config be in a module that would be loaded via init_by_lua?

from ledge.

pintsized avatar pintsized commented on July 17, 2024

Could all the config be in a module that would be loaded via init_by_lua?

I think using init_by_lua for loading ledge (and resty.rack) makes a lot of sense, and on initial tests does improve performance. By loading the code module globally, but placing all config into ngx.ctx, we have the best of both worlds in terms of performance and flexibility.

This being said, if ledge.set() acted globally (in a local table) when loaded with init_by_lua you could feasibly load global config options only once per server reload.

I'm not sure if ledge will know what phase it is though? (perhaps that's a feature req for lua-nginx-module?). Maybe we'd need ledge.gset() for use within init_by_lua? Worth looking into.

from ledge.

pintsized avatar pintsized commented on July 17, 2024

This is looking ok for now. There will be further changes, but at least the ambiguity has been removed.

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.