- Notifications
You must be signed in to change notification settings - Fork19
openresty/meta-lua-nginx-module
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
meta-lua-nginx-module - templates and toolchains for generatinghttp-lua-nginx-module andstream-lua-nginx-module.
$ make SUBSYS=stream DESTDIR=/path/to/stream-lua-nginx-module/src -j4
All make options are optional.
| Option | Meaning | Default |
|---|---|---|
| SUBSYS | Subsystem this build is for | http |
| DESTDIR | Directory the generated files should go | build/src |
├── src: all source files│ ├── http: http subsystem specific files, not rendered by the template engine│ ├── stream: stream subsystem specific files, not rendered by the template engine│ └── subsystem: templates file that are shared between subsystems, rendered by the template engine└── utils: build toolchainsFirst, determine where the change should go to. As an example, if you would like to changea file insidelua-nginx-module, that file could either be rendered through the template engine,or be simply copied from thesrc/http directory as-is without going through the template engine.
To tell which one is the case, look at the first few lines of the generated file. A file rendered bythe template engine will have something like this at it's beginning:
/* * !!! DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN !!! * Generated from: src/subsystem/ngx_subsystem_foo.c.tt2 */
Next, edit the file and use command similar to the following to build the new source code:
$ make SUBSYS=http DESTDIR=../lua-nginx-module/src -j4
Next, update the tests inside the respective repository. In this case, they will be under../lua-nginx-module/t.
Finally, create PRs for both themeta-lua-nginx-module andlua-nginx-module.
All the files undersrc/subsystem are validPerl TT2 files and should be renderableusing themini-tt2.pl tool inside this repo, thelemplateor the officialPerl TT2 renderer.
Note: Themini-tt2.pl tool has been specifically tailored for rendering C source codes and will reformatto make sure the rendered file follows the general styling guidelines of NGINX and OpenResty projects.Rendering using other TT2 compatible renderers should yield files that can be build but not necessarily correctin terms of styling.
In general, you should always use themini-tt2.pl tool while working with this repository and only submitfiles rendered by it tolua-nginx-module andstream-lua-nginx-module. You should also avoid using any TT2 featuresthat themini-tt2.pl tool does not support unless there is a very good reason to do so.
Themini-tt2.pl tool supports the following subset of TT2 features:
[% foo = 'abc' %][% SET foo = 'def' %]Note thatSET is optional and both forms above are equivalent.
[% foo %][% IF foo == 'abc' %]Foo is abc![% ELSIF subsys %]Foo is not abc![% END %][% IF foo == 'def' %]Foo is def![% END %][%# this will not appear inside rendered file #%][% BLOCK snippet %]I am a snippet.[% END %][% INCLUDE snippet %]Hello![% PROCESS snippet %]This will be rendered as:
I am a snippet.Hello!I am a snippet.Note: Passing variables to block isnot supported.INCLUDE andPROCESS directivesare equivalent.
For convenience, themini-tt2.pl tool always automatically inject the following variablesinto the template context:
Their value depends only on theSUBSYS option passed when invokingmake.
Note: Variable names in TT2 are case-sensitive.
| Variable | Type | Value whenSUBSYS == "http" | Value whenSUBSYS == "stream" |
|---|---|---|---|
subsys | String | "http" | "stream" |
SUBSYS | String | "HTTP" | "STREAM" |
req_type | String | "ngx_http_request_t" | "ngx_stream_lua_request_t" |
req_subsys | String | "http" | "stream_lua" |
http_subsys | Boolean | 1 | 0 |
stream_subsys | Boolean | 0 | 1 |
Whitespace control using output modifiers like[% foo -%] is not necessary. Themini-tt2.pl toolalways suppresses whitespaces caused by template directives in the rendered files.
Theopenresty-en mailing list is for English speakers.
Theopenresty mailing list is for Chinese speakers.
This repository is licensed under the BSD license.
Copyright (C) 2009-2017, by Xiaozhe Wang (chaoslawful)chaoslawful@gmail.com.
Copyright (C) 2009-2019, by Yichun "agentzh" Zhang (章亦春)agentzh@gmail.com, OpenResty Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
About
Meta Lua Nginx Module supporting both Http Lua Module and Stream Lua Module
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors9
Uh oh!
There was an error while loading.Please reload this page.