Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,36 @@ kong stop
deactivate
```

### Running Standalone Lua Scripts

Activate the venv before using any of the commands below.

#### `resty` - for scripts using OpenResty APIs (`ngx.*`, cosocket, `cjson`, `resty.*`)

```bash
source bazel-bin/build/kong-dev-venv.sh
resty my_script.lua
```

Scripts can use a shebang (`#!/usr/bin/env resty`). See `scripts/changelog-helper.lua` for an example.

#### `kong runner` - for scripts that need `kong.db`, `kong.configuration`, or the PDK

CLI arguments are available as a global `args` table (`args[1]` is the script filename).

```bash
kong runner my_script.lua arg1 arg2
```

#### `luajit` - for pure Lua scripts with no nginx/OpenResty APIs

```bash
source bazel-bin/build/kong-dev-venv.sh
luajit my_script.lua
```

---

### Install Development Dependencies

#### Running for development
Expand Down
Loading