Skip to content
prasad-kumkar edited this page May 5, 2025 · 1 revision

Config

The jam.config module handles all configuration aspects of the Tessera node, from loading configuration files to providing a unified interface for accessing configuration values.

Configuration Components

The configuration system consists of several components:

Node Configuration

The main configuration for the Tessera node:

  • Network: Network-related settings (ports, peers, etc.)
  • API: API endpoint configuration
  • Database: Storage configuration
  • Logging: Logging settings and levels
  • Validator: Validator-specific configuration

Chain Configuration

Chain-specific parameters are handled through the Chain Specification system.

Configuration Sources

Tessera supports multiple configuration sources:

  • Configuration Files: JSON or YAML configuration files
  • Environment Variables: Override configuration via environment variables
  • Command-Line Arguments: Override configuration via CLI arguments
  • Default Values: Sensible defaults for all settings

Usage

from jam.config import NodeConfig

# Load configuration from file
config = NodeConfig.from_file("config.json")

# Access configuration values
network_port = config.network.port
api_enabled = config.api.enabled

# Override configuration value
config.network.max_peers = 100

# Save configuration
config.save("updated_config.json")

Configuration Schema

The configuration follows this basic schema:

{
    "node": {
        "name": "tessera-node-1",
        "data_dir": "./data"
    },
    "network": {
        "port": 30333,
        "address": "0.0.0.0",
        "max_peers": 50,
        "bootstrap_nodes": [...]
    },
    "api": {
        "http_enabled": true,
        "http_port": 9933,
        "ws_enabled": true,
        "ws_port": 9944
    },
    "database": {
        "path": "./data/db",
        "cache_size_mb": 512
    },
    "logging": {
        "level": "info",
        "file": "./logs/node.log"
    },
    "validator": {
        "enabled": false,
        "keys_path": "./keys"
    }
}

Environment Variables

Configuration can be overridden with environment variables using the pattern:

JAM_SECTION_SETTING=value

For example:

  • JAM_NETWORK_PORT=12345 - Sets the network port to 12345
  • JAM_API_HTTP_ENABLED=false - Disables HTTP API
  • JAM_LOGGING_LEVEL=debug - Sets logging level to debug

Command-Line Interface

The Tessera CLI supports configuration via command-line arguments:

# Specify configuration file
jam --config=my-config.json

# Override network port
jam --network-port=12345

# Enable validator mode
jam --validator

# Specify chain specification
jam --chain=tiny

Clone this wiki locally