2023-06-15 14:54:02 +01:00
---
2023-06-15 21:42:35 +01:00
title: Node Configuration Methods
2023-11-23 12:01:32 +01:00
hide_table_of_contents: true
2023-06-15 14:54:02 +01:00
---
2023-06-15 17:28:53 +01:00
Waku nodes can be configured using a combination of the following methods:
2023-06-15 14:54:02 +01:00
1. Command line options and flags
2023-06-20 12:41:55 +01:00
2. Environment variables
2023-06-18 09:34:09 +01:00
3. TOML configuration files (currently the only supported format)
2023-06-15 14:54:02 +01:00
4. Default values
:::info
2023-07-16 00:08:27 +01:00
Take note of the precedence order: Each configuration method overrides the one below it (e.g., command line options override environment variables and configuration files).
2023-06-15 14:54:02 +01:00
:::
2023-11-23 12:01:32 +01:00
## Command line options
2023-06-15 14:54:02 +01:00
2023-11-23 12:01:32 +01:00
Node configuration is primarily done using command line options, which override other methods. Specify [configuration options ](/guides/nwaku/config-options ) by providing them in this format after the binary name:
2023-06-15 14:54:02 +01:00
2023-11-23 12:01:32 +01:00
```shell
2023-06-18 09:34:09 +01:00
./build/wakunode2 --tcp-port=65000
2023-06-15 14:54:02 +01:00
```
When running your node with Docker, provide the command line options after the image name in this format:
2023-11-23 12:01:32 +01:00
```shell
2025-05-20 11:01:12 +05:30
docker run wakuorg/nwaku --tcp-port=65000
2023-06-15 14:54:02 +01:00
```
2023-11-23 12:01:32 +01:00
## Environment variables
2023-06-15 14:54:02 +01:00
2023-06-15 21:42:35 +01:00
Nodes can be configured using environment variables by prefixing the variable name with `WAKUNODE2_` and using the configuration option in [SCREAMING_SNAKE_CASE ](https://en.wiktionary.org/wiki/screaming_snake_case ) format.
2023-06-15 14:54:02 +01:00
2023-06-15 21:42:35 +01:00
To set the `tcp-port` configuration, the `wakunode2` binary should be called in this format:
2023-06-15 14:54:02 +01:00
2023-11-23 12:01:32 +01:00
```shell
2023-06-18 09:34:09 +01:00
WAKUNODE2_TCP_PORT=65000 ./build/wakunode2
2023-06-15 14:54:02 +01:00
```
When running your node with Docker, start the node using the `-e` command option:
2023-11-23 12:01:32 +01:00
```shell
2025-05-20 11:01:12 +05:30
docker run -e "WAKUNODE2_TCP_PORT=65000" wakuorg/nwaku
2023-06-15 14:54:02 +01:00
```
:::info
2023-06-18 09:34:09 +01:00
This is the second configuration method in order of precedence. [Command Line Options ](#command-line-options ) override environment variables.
2023-06-15 14:54:02 +01:00
:::
2023-11-23 12:01:32 +01:00
## Configuration files
2023-06-15 14:54:02 +01:00
Nodes can be configured using a configuration file following the [TOML ](https://toml.io/en/ ) format:
```toml title="TOML Config File" showLineNumbers
log-level = "DEBUG"
tcp-port = 65000
2023-06-18 09:34:09 +01:00
topic = ["/waku/2/default-waku/proto"]
metrics-logging = false
2023-06-15 14:54:02 +01:00
```
2023-11-23 12:01:32 +01:00
The `config-file` [configuration option ](/guides/nwaku/config-options ) lets you specify the configuration file path:
2023-06-15 14:54:02 +01:00
2023-11-23 12:01:32 +01:00
```shell
2023-06-18 09:34:09 +01:00
./build/wakunode2 --config-file=[TOML CONFIGURATION FILE]
2023-06-15 14:54:02 +01:00
```
You can also specify the configuration file via environment variables:
2023-11-23 12:01:32 +01:00
```shell
2023-06-15 14:54:02 +01:00
# Using environment variables
2023-06-18 09:34:09 +01:00
WAKUNODE2_CONFIG_FILE=[TOML CONFIGURATION FILE] ./build/wakunode2
2023-06-15 14:54:02 +01:00
# Using environment variables with Docker
2025-05-20 11:01:12 +05:30
docker run -e "WAKUNODE2_CONFIG_FILE=[TOML CONFIGURATION FILE]" wakuorg/nwaku
2023-06-15 14:54:02 +01:00
```
:::info
2023-06-18 09:34:09 +01:00
This is the third configuration method in order of precedence. [Command Line Options ](#command-line-options ) and [Environment Variables ](#environment-variables ) override configuration files.
2023-06-15 14:54:02 +01:00
:::
2023-11-23 12:01:32 +01:00
## Default configuration values
2023-06-15 14:54:02 +01:00
2023-06-18 09:34:09 +01:00
The default configuration is used when no other options are specified. By default, a `nwaku` node does the following:
2023-06-15 14:54:02 +01:00
2023-06-18 09:34:09 +01:00
- Generate a new `Node Key` and `PeerID` .
- Listen for incoming libp2p connections on the default TCP port (`60000` ).
- Subscribe to the default Pub/Sub topic (`/waku/2/default-waku/proto` ).
- Enable the `Relay` protocol for relaying messages.
- Enable the `Store` protocol as a client, allowing it to query peers for historical messages but not store any message itself.
2023-06-15 14:54:02 +01:00
2023-11-23 12:01:32 +01:00
To see the default values of all [configuration options ](/guides/nwaku/config-options ), run `wakunode2 --help` :
2023-06-15 14:54:02 +01:00
2023-11-23 12:01:32 +01:00
```shell
2023-06-18 09:34:09 +01:00
./build/wakunode2 --help
2023-06-16 09:40:22 +01:00
```
:::tip
2023-11-23 12:01:32 +01:00
To explore the available node configuration options, have a look at the [Node Configuration Options ](/guides/nwaku/config-options ) guide.
2024-03-20 14:56:30 +01:00
:::