This is the first function called by the server immediately after it begins listening on the configured address and port (default: 127.0.0.1:1983
) and before the socket accepts any client connections. It will be called only once during the server lifetime, and will provide the CLI options to the program as a Lua table cli
. The server will not accept a return value from this function. However, it will abort if the function raises a Lua error.
function startup(cli)
-- The `cli` table looks like:
{
keep_alive_text = "keep-alive",
script = "script.lua",
script_tick = 500,
log_level = "INFO",
pub_path = "/sse",
sub_path = "/sse",
keep_alive = 60000,
timeout_retry = 0,
timeout = 300000,
serve_static_path = "/",
capacity = 256,
listen = "127.0.0.1:1983",
unsafe_script = false
}
end