<a id="wasm-wasmtime"></a>

# Wasmtime

The module provides integration with the [Wasmtime](https://wasmtime.dev/)
runtime for executing WASM code,
adding a number of runtime-specific directives
to the [wasm_modules](https://en.angie.software//angie/docs/configuration/modules/wasm/index.md#wasm-modules) context.

In our repositories, the module is built
[dynamically](https://en.angie.software//angie/docs/installation/index.md#install-dynamicmodules)
and is available as a separate package named `angie-module-wasmtime`.

<a id="configuration-example-77"></a>

## Configuration Example

```nginx
wasm_modules {

    wasmtime_stack_size 8k;

    wasmtime_enable_wasi on;

    load fft_transform.wasm id=fft;
}
```

<a id="directives-86"></a>

## Directives

<a id="index-0"></a>

<a id="wasmtime-enable-wasi"></a>

### wasmtime_enable_wasi

| [Syntax](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)   | `wasmtime_enable_wasi` `on` | `off`;   |
|------------------------------------------------------------------------------------------|----------------------------------------|
| Default                                                                                  | `wasmtime_enable_wasi on;`             |
| [Context](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)  | wasm_modules                           |

Enables or disables the use of
[WebAssembly System Interface](https://github.com/WebAssembly/WASI) APIs
that provide basic [POSIX-like functionality](https://wasi.dev/interfaces)
to WASM modules running in Angie.

#### NOTE
Angie-specific APIs can be explicitly allowed using the [load](https://en.angie.software//angie/docs/configuration/modules/wasm/index.md#load) directive.

<a id="index-1"></a>

<a id="wasmtime-stack-size"></a>

### wasmtime_stack_size

| [Syntax](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)   | `wasmtime_stack_size` size;   |
|------------------------------------------------------------------------------------------|-------------------------------|
| Default                                                                                  | `wasmtime_stack_size 8k;`     |
| [Context](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)  | wasm_modules                  |

Sets the
[max_wasm_stack](https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.max_wasm_stack)
value to the specified [size](https://en.angie.software//angie/docs/configuration/configfile.md#syntax),
thus limiting the maximum amount of stack space available for executing WASM code.
