Configuring lattice is pretty straight-forward. The main goal in lattice configuration for a wasmcloud host is to supply connection parameters to a NATS server. For anonymous authentication this could simply be the URL and port of the NATS server, or for NATS 2.x decentralized authentication, this can include the client secret (seed key) and the user JWT (the combination of which is referred to as a “credentials file”).

For more information on the various ways you can connect to and configure NATS servers, please consult the NATS documentation.

Configuring the wasmcloud Binary

There are a number of environment variables that can be supplied for the wasmcloud binary. These can also be supplied via command-line options, though for security purposes it’s often preferred to use environment variables as those values cannot be retrieved from the global process list.

RPC_HOSTNATS host for lattice RPC
RPC_PORTNATS port for lattice RPC
RPC_JWTUser JWT for lattice RPC
RPC_SEEDUser seed for lattice RPC
RPC_CREDSCreds file for lattice RPC (replaces jwt+seed)
CONTROL_HOSTNATS host for lattice control interface
CONTROL_PORTNATS port for lattice control
CONTROL_JWTUser JWT for lattice control
CONTROL_SEEDUser seed for lattice control
CONTROL_CREDSNATS creds file for lattice control (replaces jwt+seed)

Configuring the wasmcloud Host API

If you are building your own custom wasmcloud host, then you’ll be using the wasmcloud-host crate and the HostBuilder struct. Please consult the Rust documentation on this crate for information on how to create hosts. It’s worth pointing out that the host and host builder prevent runtime changes to critical components, like the lattice configuration. While you can add and remove actors and capability providers at runtime, you cannot reconfigure the lattice connection while the host is running.