Uh oh!
There was an error while loading. Please reload this page.
feat: scripts/run + README run instructions for the OpenResty demo - #6
Conversation
The compiled Lua.Ngx bindings wrap the ngx.* API the lua-nginx-module injects, so they only run inside an OpenResty worker. scripts/run serves the dist modules under OpenResty (locations /say and /status) so they can be curled, mirroring scripts/build. - flake.nix: add openresty to the dev shell so `nix develop -c ./scripts/run` works. - scripts/run: generate a minimal nginx.conf and serve dist/*.lua via dofile. - README.md: document build, run, and how to consume the bindings (dofile + curried Effect). - .gitignore: ignore the direnv cache (.direnv/).
There was a problem hiding this comment.
Pull request overview
Adds a first-class way to run and manually exercise the generated Lua.Ngx* Lua modules inside an OpenResty worker, along with documentation and Nix-shell support so contributors can curl a working demo without hand-writing an nginx config.
Changes:
- Add
scripts/runto generate a temporarynginx.confand servedist/*.luavia OpenResty with/sayand/statusendpoints. - Extend the dev shell (
flake.nix) to includeopenrestysonix develop -c ./scripts/runworks out of the box. - Document build/run usage and embedding the linked
dist/*.luamodules in your own nginx config; ignore.direnv/.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/run | New demo runner that launches OpenResty with a generated nginx config to execute dist/Lua.Ngx*.lua via dofile. |
| README.md | Adds build/run instructions and explains how to load linked modules (literal-dot filenames) and call curried Effect thunks. |
| flake.nix | Adds openresty to the dev shell toolchain for running the demo. |
| .gitignore | Ignores .direnv/ artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- scripts/run — validate PORT is a 1..65535 integer before interpolating it into the config (#6 (comment)) - scripts/run — fail fast if either served dist module is missing, not just Lua.Ngx.lua (#6 (comment))
Uh oh!
There was an error while loading. Please reload this page.
Adds a way to actually run the compiled bindings, plus the docs to go with it.
The Lua.Ngx bindings wrap the
ngx.*API that the lua-nginx-module injects, so they only work inside an OpenResty worker. Until now there was no way to exercise them short of hand writing an nginx config. This addsscripts/run, which generates a minimal config and serves the dist modules under OpenResty so you can curl them, mirroring howscripts/buildproduces them.Changes:
nix develop -c ./scripts/runhas everything it needs, pinned by the flake like the rest of the toolchain.dist/*.luaviadofile, with/sayand/statuslocations.PORT=overrides the listen port. It fails fast with a clear message if openresty is not on PATH (the common case being a direnv shell that predates this change), pointing atnix develop -c ./scripts/runordirenv reload.Verified locally:
nix develop -c ./scripts/runserves on :8099,curl /sayreturns the greeting, andcurl /statusshows the HTTP_OK constant (200) with ngx.status set to 404.