Building LaiRu

cd lasso-rust
cargo build          # debug build
cargo build --release  # optimised build
cargo test           # run the full test suite

The built binaries are at target/debug/lairu and target/debug/lairu-fpm. After cargo install --path . or copying the binaries to your PATH, you can call lairu directly without cargo run --.


eval

Evaluate a Lasso expression or short snippet supplied as a string argument.

lairu eval "local(name) = 'LaiRu'; #name + ' 0.1'"
lairu eval "array(1, 2, 3)->sum"
lairu eval "6 * 7"

The result of the last expression is printed. Assignments print nothing. This is the fastest way to test a snippet without creating a file.


run

Execute a .lasso file as a script. Text output is written to stdout.

lairu run examples/core.lasso
lairu run myscript.lasso

Script mode evaluates the whole file as Lasso code without template processing. Use render instead when you have a file that mixes HTML and Lasso.


render

Render a template file. Text content passes through and bracketed Lasso expressions are evaluated and substituted into the output.

lairu render examples/index.lasso
lairu render mypage.lasso

The output goes to stdout. Useful for testing a template page without starting the full HTTP service.


check

Parse a file and report any syntax errors without executing it.

lairu check examples/core.lasso
lairu check mypage.lasso

Exits with a non-zero status code on parse failure, which makes it suitable for CI checks on Lasso source files.


ast

Parse a file and print its abstract syntax tree.

lairu ast examples/core.lasso

Helpful when debugging a parse problem or understanding how a piece of code is structured internally.


compat-report

Print a compatibility fixture report — how many fixture files exist per category and how many are passing in the current build.

lairu compat-report

Useful for tracking progress toward Lasso 9 compatibility. New compatibility work should start with a fixture under lasso-rust/tests/fixtures/.


serve

Start the built-in HTTP service over a TCP address or unix socket.

lairu serve --addr 127.0.0.1:9010 --docroot /var/www/html
lairu serve --unix /run/lairu/lairu.sock --docroot /var/www/html
lairu serve --config /etc/lairu/config/lairu.ini
FlagDescription
--addr host:portTCP address to listen on.
--unix /path/to/file.sockUnix socket path.
--docroot /pathDocument root directory.
--config /path/to/lairu.iniPath to configuration file.

Without --config, LaiRu searches config/ next to the binary then falls back to /etc/lairu/config/. See the Service page for full configuration documentation.


fpm

Start LaiRu as a FastCGI process manager. Also available as a standalone lairu-fpm binary.

lairu fpm --unix /run/lairu/lairu-fpm.sock --docroot /var/www/html
lairu fpm --addr 127.0.0.1:9000 --max-children 8
lairu-fpm --config /etc/lairu/config/lairu.ini
FlagDescription
--addr host:portFastCGI TCP address.
--unix /path/to/file.sockFastCGI unix socket.
--docroot /pathDefault document root (overridable per-request by nginx/Apache).
--max-children nMaximum concurrent worker connections.
--config /path/to/lairu.iniPath to configuration file.

Environment Variables

VariableEffect
LAIRU_TEMPLATE_CACHESet to 0 to disable template source caching.
LAIRU_PARSE_CACHESet to 0 to disable parsed code-fragment caching.
LAIRU_RUNTIME_POOL_SIZEPer-thread runtime pool size (default 8; 0 disables reuse).
LAIRU_MAX_HEADER_BYTESMaximum request header size in bytes.
LAIRU_MAX_REQUEST_BODYMaximum total request body size.
LAIRU_MAX_UPLOAD_BYTESMaximum size per uploaded file.
LAIRU_UPLOAD_SPOOL_BYTESThreshold above which uploads are spooled to disk.
LAIRU_UPLOAD_TMPDIRTemporary directory for spooled uploads.
LAIRU_UPLOAD_DESTDIRDestination directory for accepted uploads.
LAIRU_UPLOAD_KEEP_TEMPSet to 1 to keep spooled temp files after render.
LAIRU_UPLOAD_ALLOWED_EXTENSIONSComma-separated extension allow list.
LAIRU_UPLOAD_ALLOWED_TYPESComma-separated MIME type allow list.
LAIRU_SESSION_STOREmemory, file, or none.
LAIRU_SESSION_DIRDirectory for file-backed sessions.
LAIRU_SESSION_SECRETHMAC-SHA256 secret for signed session cookies.
LAIRU_TRUST_PROXYSet to 0 to ignore Forwarded / X-Forwarded-* headers.
LAIRU_FILE_ROOTSandbox root for file API calls.
LAIRU_FILE_ROOT_REQUIREDSet to 1 to reject file access without a configured root.
LAIRU_MAX_SLEEP_MSOptional cap on sleep() duration.