{"id":28479009,"url":"https://github.com/openresty/meta-lua-nginx-module","last_synced_at":"2025-07-03T09:31:18.582Z","repository":{"id":24673453,"uuid":"101508839","full_name":"openresty/meta-lua-nginx-module","owner":"openresty","description":"Meta Lua Nginx Module supporting both Http Lua Module and Stream Lua Module","archived":false,"fork":false,"pushed_at":"2021-10-15T15:19:01.000Z","size":1020,"stargazers_count":65,"open_issues_count":9,"forks_count":20,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-06-28T13:13:49.600Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openresty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-26T19:36:56.000Z","updated_at":"2024-12-15T11:37:29.000Z","dependencies_parsed_at":"2022-08-07T11:01:14.305Z","dependency_job_id":null,"html_url":"https://github.com/openresty/meta-lua-nginx-module","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openresty/meta-lua-nginx-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fmeta-lua-nginx-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fmeta-lua-nginx-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fmeta-lua-nginx-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fmeta-lua-nginx-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openresty","download_url":"https://codeload.github.com/openresty/meta-lua-nginx-module/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fmeta-lua-nginx-module/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263300190,"owners_count":23445196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-07T18:07:44.754Z","updated_at":"2025-07-03T09:31:18.573Z","avatar_url":"https://github.com/openresty.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/openresty/meta-lua-nginx-module.svg?branch=master)](https://travis-ci.org/openresty/meta-lua-nginx-module)\n\n# Name\n\nmeta-lua-nginx-module - templates and toolchains for generating\n[http-lua-nginx-module](https://github.com/openresty/lua-nginx-module) and\n[stream-lua-nginx-module](https://github.com/openresty/stream-lua-nginx-module).\n\nTable of Contents\n=================\n\n* [Name](#name)\n* [Usage](#usage)\n    * [Supported Make Options](#supported-make-options)\n* [Directory Structures](#directory-structures)\n* [Developing](#developing)\n    * [General Workflow](#general-workflow)\n    * [Template Features](#template-features)\n        * [Variable Assignments](#variable-assignments)\n        * [Variable Output](#variable-output)\n        * [Branching](#branching)\n        * [Comment](#comment)\n        * [Snippet Reuse](#snippet-reuse)\n        * [Built-in Variables](#built-in-variables)\n        * [Whitespace Control](#whitespace-control)\n* [Community](#community)\n    * [English Mailing List](#english-mailing-list)\n    * [Chinese Mailing List](#chinese-mailing-list)\n* [Copyright and License](#copyright-and-license)\n\n# Usage\n\n```shell\n$ make SUBSYS=stream DESTDIR=/path/to/stream-lua-nginx-module/src -j4\n```\n\nAll make options are optional.\n\n## Supported Make Options\n\n| Option        | Meaning                                             | Default     |\n| ------------- | --------------------------------------------------- | ----------- |\n| SUBSYS        | Subsystem this build is for                         | `http`      |\n| DESTDIR       | Directory the generated files should go             | `build/src` |\n\n# Directory Structures\n```\n├── src: all source files\n│   ├── http: http subsystem specific files, not rendered by the template engine\n│   ├── stream: stream subsystem specific files, not rendered by the template engine\n│   └── subsystem: templates file that are shared between subsystems, rendered by the template engine\n└── utils: build toolchains\n```\n\n[Back to TOC](#table-of-contents)\n\n# Developing\n## General Workflow\n\nFirst, determine where the change should go to. As an example, if you would like to change\na file inside `lua-nginx-module`, that file could either be rendered through the template engine,\nor be simply copied from the `src/http` directory as-is without going through the template engine.\n\nTo tell which one is the case, look at the first few lines of the generated file. A file rendered by\nthe template engine will have something like this at it's beginning:\n\n```C\n/*\n * !!! DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN !!!\n * Generated from: src/subsystem/ngx_subsystem_foo.c.tt2\n */\n```\n\nNext, edit the file and use command similar to the following to build the new source code:\n\n```shell\n$ make SUBSYS=http DESTDIR=../lua-nginx-module/src -j4\n```\n\nNext, update the tests inside the respective repository. In this case, they will be under `../lua-nginx-module/t`.\n\nFinally, create PRs for both the `meta-lua-nginx-module` and `lua-nginx-module`.\n\n[Back to TOC](#table-of-contents)\n\n## Template Features\n\nAll the files under `src/subsystem` are valid [Perl TT2](http://www.template-toolkit.org) files and should be renderable\nusing the `mini-tt2.pl` tool inside this repo, the [lemplate](https://github.com/openresty/lemplate)\nor the official [Perl TT2](http://www.template-toolkit.org) renderer.\n\n**Note:** The `mini-tt2.pl` tool has been specifically tailored for rendering C source codes and will reformat\nto make sure the rendered file follows the general styling guidelines of NGINX and OpenResty projects.\nRendering using other TT2 compatible renderers should yield files that can be build but not necessarily correct\nin terms of styling.\n\nIn general, you should always use the `mini-tt2.pl` tool while working with this repository and only submit\nfiles rendered by it to `lua-nginx-module` and `stream-lua-nginx-module`. You should also avoid using any TT2 features\nthat the `mini-tt2.pl` tool does not support unless there is a very good reason to do so.\n\nThe `mini-tt2.pl` tool supports the following subset of TT2 features:\n\n[Back to TOC](#table-of-contents)\n\n### Variable Assignments\n```\n[% foo = 'abc' %]\n[% SET foo = 'def' %]\n```\n\nNote that `SET` is optional and both forms above are equivalent.\n\n[Back to TOC](#table-of-contents)\n\n### Variable Output\n```\n[% foo %]\n```\n\n[Back to TOC](#table-of-contents)\n\n### Branching\n```\n[% IF foo == 'abc' %]\nFoo is abc!\n[% ELSIF subsys %]\nFoo is not abc!\n[% END %]\n\n\n[% IF foo == 'def' %]\nFoo is def!\n[% END %]\n```\n\n[Back to TOC](#table-of-contents)\n\n### Comment\n```\n[%# this will not appear inside rendered file #%]\n```\n\n[Back to TOC](#table-of-contents)\n\n### Snippet Reuse\n```\n[% BLOCK snippet %]\nI am a snippet.\n[% END %]\n\n[% INCLUDE snippet %]\nHello!\n[% PROCESS snippet %]\n```\n\nThis will be rendered as:\n```\nI am a snippet.\nHello!\nI am a snippet.\n```\n\n**Note:** Passing variables to block is **not** supported. `INCLUDE` and `PROCESS` directives\nare equivalent.\n\n[Back to TOC](#table-of-contents)\n\n### Built-in Variables\nFor convenience, the `mini-tt2.pl` tool always automatically inject the following variables\ninto the template context:\n\nTheir value depends only on the `SUBSYS` option passed when invoking `make`.\n\n**Note:** Variable names in TT2 are case-sensitive.\n\n| Variable        | Type     | Value when `SUBSYS == \"http\"` | Value when `SUBSYS == \"stream\"` |\n| --------------- | -------- | ----------------------------- | ------------------------------- |\n| `subsys`        | String   | `\"http\"`                      | `\"stream\"`                      |\n| `SUBSYS`        | String   | `\"HTTP\"`                      | `\"STREAM\"`                      |\n| `req_type`      | String   | `\"ngx_http_request_t\"`        | `\"ngx_stream_lua_request_t\"`    |\n| `req_subsys`    | String   | `\"http\"`                      | `\"stream_lua\"`                  |\n| `http_subsys`   | Boolean  | `1`                           | `0`                             |\n| `stream_subsys` | Boolean  | `0`                           | `1`                             |\n\n[Back to TOC](#table-of-contents)\n\n### Whitespace Control\nWhitespace control using output modifiers like `[% foo -%]` is not necessary. The `mini-tt2.pl` tool\nalways suppresses whitespaces caused by template directives in the rendered files.\n\n[Back to TOC](#table-of-contents)\n\n# Community\n\n## English Mailing List\n\nThe [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers.\n\n[Back to TOC](#table-of-contents)\n\n## Chinese Mailing List\n\nThe [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers.\n\n[Back to TOC](#table-of-contents)\n\n# Copyright and License\n\nThis repository is licensed under the BSD license.\n\nCopyright (C) 2009-2017, by Xiaozhe Wang (chaoslawful) \u003cchaoslawful@gmail.com\u003e.\n\nCopyright (C) 2009-2019, by Yichun \"agentzh\" Zhang (章亦春) \u003cagentzh@gmail.com\u003e, OpenResty Inc.\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n* 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.\n\nTHIS 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.\n\n[Back to TOC](#table-of-contents)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Fmeta-lua-nginx-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenresty%2Fmeta-lua-nginx-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Fmeta-lua-nginx-module/lists"}