Configuration
Proper configuration is key to effectively using the Blocklet CLI and managing your Blocklet Server. There are two primary levels of configuration: local CLI settings managed via the blocklet config command, and the server-wide settings defined in the config.yml file.
This guide covers both, helping you set up your development environment and your server instances correctly. For a hands-on approach to creating a server configuration, see the server init command.
CLI Configuration#
The blocklet config command allows you to manage local configuration settings for the CLI itself. These settings, such as your Blocklet Store credentials and default registry, are stored in a configuration file within your user directory. This command is essential for tasks like publishing blocklets to a store.
Usage#
The blocklet config command follows a simple key-value pattern.
- List all configurations:
blocklet configorblocklet config list - Get a specific key:
blocklet config get <key> - Set a key-value pair:
blocklet config set <key> <value> - Delete a key:
blocklet config unset <key>
Configurable Keys#
You can set the following keys using blocklet config set. The CLI validates the values to ensure they are correctly formatted.
Key | Description | Example Value |
|---|---|---|
| The URL of the Blocklet Store you want to connect to. |
|
| The URL of the blocklet registry. It's an alias for |
|
| The secret access token for authenticating with the Blocklet Store. | A valid secret key string. |
| Your developer DID for identity verification. |
|
| Your developer name. |
|
| Your developer email. |
|
Examples#
Set the Blocklet Store URL
blocklet config set store https://store.blocklet.dev
# Success: Config store successfullyList current configurations
blocklet config
# Output:
# { "store": "https://store.blocklet.dev" }Remove a configuration
blocklet config unset store
# Success: Delete config store successfullyServer Configuration (config.yml)#
Every Blocklet Server instance is governed by a config.yml file located in its data directory. This file is automatically generated when you run blocklet server init and contains all the critical parameters for the server's operation, from network ports to wallet keys and memory limits.
While you typically don't need to edit this file manually after initialization, understanding its structure is useful for debugging and advanced setup.
Structure Overview#
The config.yml file is organized into several top-level keys, primarily node and blocklet.
# config.yml
# Core settings for the Blocklet Server instance
node:
# --- Metadata ---
name: 'My ABT Node'
description: 'A description for my node'
mode: 'production' # 'production' or 'debug'
# --- Server Wallet/Identity ---
# The server's secret key, encrypted for security
sk: 'encrypted:...'
pk: '...' # Public key
did: 'z...' # Server's DID
# --- Network & Dashboard ---
port: 8089 # Port for the admin dashboard
https: true # Whether to enable HTTPS
secret: '...' # Session secret for the dashboard
# --- Routing Engine Settings ---
routing:
provider: 'nginx' # or 'caddy'
adminPath: '/admin'
httpPort: 80
httpsPort: 443
wildcardCertHost: 'https://certs.arcblock.io'
# ... other routing settings
# --- Resource Limits ---
runtimeConfig:
daemonMaxMemoryLimit: 2048 # In MB
blockletMaxMemoryLimit: 1024 # In MB
# --- DID & Wallet Services ---
didRegistry: 'https://did.arcblock.io/api'
webWalletUrl: 'https://wallet.arcblock.io'
# Default settings for blocklets running on this server
blocklet:
# Port range for blocklets starts from `node.port + 1`
port: 8089
# Default registry for fetching blocklets
registry: https://blocklet.arcblockio.cn Key Sections Explained#
node: Contains all settings directly related to the Blocklet Server daemon.- Metadata:
nameanddescriptionfor identifying your server. - Wallet/Identity:
sk,pk, anddiddefine the server's unique identity on the network. Theskis always encrypted using a key file stored alongside the config. - Network & Dashboard:
port,https, andsecretconfigure access to the server's web-based admin interface. routing: Defines the behavior of the server's entry point, managing how traffic is routed to the dashboard and individual blocklets. It includes port settings (httpPort,httpsPort) and the HTTPS certificate provider (wildcardCertHost).runtimeConfig: Sets memory limits for the main server process (daemonMaxMemoryLimit) and for each running blocklet (blockletMaxMemoryLimit) to ensure stability.
- Metadata:
blocklet: Contains default settings that apply to blocklets running on the server.port: This value is used as a base. Blocklets are assigned ports incrementally, starting fromnode.port + 1.registry: The default Blocklet Store URL from which the server will fetch blocklets.
By understanding these two configuration methods, you have full control over both your local development tools and your deployed Blocklet Server instances. To create your first server configuration, proceed to the Getting Started guide.