|
| 1 | +# Runtime Configuration |
| 2 | + |
| 3 | +## Structure |
| 4 | + |
| 5 | +The configuration is structured as follows: |
| 6 | + |
| 7 | +- **plugins**: An array of plugin configuration objects. |
| 8 | + - **name** (`string`): Name of the plugin. |
| 9 | + - **path** (`string`): OCI path or HTTP URL or local path for the plugin. |
| 10 | + - **runtime_config** (`object`, optional): Plugin-specific runtime configuration. The available fields are: |
| 11 | + - **skip_tools** (`array[string]`, optional): List of tool names to skip loading at runtime. |
| 12 | + - **allowed_hosts** (`array[string]`, optional): List of allowed hosts for the plugin (e.g., `["1.1.1.1"]` or `["*"]`). |
| 13 | + - **allowed_paths** (`array[string]`, optional): List of allowed file system paths. |
| 14 | + - **env_vars** (`object`, optional): Key-value pairs of environment variables for the plugin. |
| 15 | + - **memory_limit** (`string`, optional): Memory limit for the plugin (e.g., `"512Mi"`). |
| 16 | + |
| 17 | +## Example (YAML) |
| 18 | + |
| 19 | +```yaml |
| 20 | +plugins: |
| 21 | + - name: time |
| 22 | + path: oci://ghcr.io/tuananh/time-plugin:latest |
| 23 | + - name: myip |
| 24 | + path: oci://ghcr.io/tuananh/myip-plugin:latest |
| 25 | + runtime_config: |
| 26 | + allowed_hosts: |
| 27 | + - "1.1.1.1" |
| 28 | + skip_tools: |
| 29 | + - "debug" |
| 30 | + env_vars: |
| 31 | + FOO: "bar" |
| 32 | + memory_limit: "512Mi" |
| 33 | +``` |
| 34 | +
|
| 35 | +## Example (JSON) |
| 36 | +
|
| 37 | +```json |
| 38 | +{ |
| 39 | + "plugins": [ |
| 40 | + { |
| 41 | + "name": "time", |
| 42 | + "path": "oci://ghcr.io/tuananh/time-plugin:latest" |
| 43 | + }, |
| 44 | + { |
| 45 | + "name": "myip", |
| 46 | + "path": "oci://ghcr.io/tuananh/myip-plugin:latest", |
| 47 | + "runtime_config": { |
| 48 | + "allowed_hosts": ["1.1.1.1"], |
| 49 | + "skip_tools": ["debug"], |
| 50 | + "env_vars": {"FOO": "bar"}, |
| 51 | + "memory_limit": "512Mi" |
| 52 | + } |
| 53 | + } |
| 54 | + ] |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +## Loading Configuration |
| 59 | + |
| 60 | +Configuration is loaded at runtime from a file with `.json`, `.yaml`, `.yml`, or `.toml` extension. The loader will parse the file according to its extension. If the file does not exist or the format is unsupported, an error will be raised. |
| 61 | + |
| 62 | +## Notes |
| 63 | + |
| 64 | +- Fields marked as `optional` can be omitted. |
| 65 | +- Plugin authors may extend `runtime_config` with additional fields, but only the above are officially recognized. |
0 commit comments