Environment Variables
Environment variables provide a powerful way to configure Blocklet Server and the blocklets it runs. They override default settings and values from configuration files, making them ideal for tailoring your setup across different environments like development, staging, and production.
Configuration Priority#
Blocklet Server applies settings in a specific order of precedence, with later sources overriding earlier ones:
- Default Values: The built-in default settings for the server.
- Configuration File: Settings defined in your
config.ymlfile. - Environment Variables: The highest priority. Any
ABT_NODE_*variable you set will take precedence over the other sources.
Blocklet-Specific Environments#
Individual blocklets can define their own required environment variables in their blocklet.yml manifest. When you run a blocklet in development mode (e.g., using blocklet dev), you can provide these variables by creating a .env file in the blocklet's root directory.
Blocklet Server uses dotenv-flow to load these files, which means you can use a cascade of files like .env, .env.development, and .env.local to manage environment-specific configurations. If any required variables are missing when you start the blocklet, the CLI will prompt you to enter them.
Blocklet Server Environment Variables#
All environment variables that control the core Blocklet Server daemon are prefixed with ABT_NODE_. The following sections provide a comprehensive reference for these variables, grouped by category.
Network and Ports#
These variables configure the network interfaces and ports that Blocklet Server and its components use.
Variable | Purpose | Default |
|---|---|---|
| Main port where the Blocklet Server daemon listens. |
|
| Port for internal service communication. |
|
| Starting port for blocklet applications. |
|
| HTTP port for the gateway/router. |
|
| HTTPS port for the gateway/router. |
|
| HTTP port specifically for the router provider. | Same as |
| HTTPS port specifically for the router provider. | Same as |
| Port for the updater service. |
|
| Port for event hub communication. |
|
| Host address for the server to bind to. |
|
Authentication and Security#
Manage access control, sessions, DIDs, and security policies.
Variable | Purpose | Default / Notes |
|---|---|---|
| Decentralized Identifier for the server instance. | System-generated |
| Public key for the server's DID. | System-generated |
| Secret key for the server's DID. | System-generated (keep secure) |
| Secret key for session encryption. | System-generated |
| Secret key for JWT token signing. | System-generated |
| Session time-to-live in seconds. |
|
| Session cache time-to-live in seconds. |
|
| Path prefix for the admin dashboard. |
|
| Comma-separated list of IP addresses allowed to access admin. | None (all IPs allowed) |
| Comma-separated list of domains allowed for CORS. | None |
| Comma-separated list of domains to block. | None |
| Additional headers to include in CORS whitelist responses. | None |
| Disable passkey user verification. Set to |
|
Database and Storage#
Configure database connections and caching mechanisms.
Variable | Purpose | Default / Notes |
|---|---|---|
| PostgreSQL connection URL. | Uses SQLite if not specified. |
| Path to SQLite cache database file. |
|
| Redis connection URL for caching. | None (uses in-memory cache) |
| Enable large cache for SQLite. Set to |
|
| Disable caching entirely. Set to |
|
| Force use of SQLite even if PostgreSQL is configured. Set to |
|
| Skip restarting PostgreSQL during startup. Set to |
|
Docker Configuration#
Customize the behavior of blocklets that run in Docker containers.
Variable | Purpose | Default |
|---|---|---|
| Disable Docker support entirely. Set to |
|
| Default memory limit for Docker containers. |
|
| Default CPU limit for Docker containers. |
|
| Default disk size limit for Docker containers. |
|
| Skip chown operations in Docker containers. Set to |
|
| Enable Docker testing mode. Set to |
|
Logging and Debugging#
Control logging levels, locations, and enable debugging modes.
Variable | Purpose | Default / Values |
|---|---|---|
| Directory for log files. |
|
| Name of the log file. |
|
| Logging level. |
|
| Enable serverless debugging mode. Set to |
|
| Enable development mode with additional debugging. Set to |
|
Performance and Limits#
Tune performance parameters and set operational limits.
Variable | Purpose | Default |
|---|---|---|
| Maximum number of cluster instances. |
|
| Backoff time for job scheduling in seconds. |
|
| Interval for refreshing blacklist in minutes. |
|
| Rate limit for email operations per minute. |
|
| Rate limit for email verification per minute. |
|
| Interval for checking running blocklets in milliseconds. |
|
| CPU threshold (%) for high load detection. |
|
| Memory threshold (%) for high load detection. |
|
| Disk threshold (%) for high load detection. |
|
| Enable automatic blocklet running assurance. Set |
|
Domain and Routing#
Configure how Blocklet Server handles domains, certificates, and routing.
Variable | Purpose | Default / Values |
|---|---|---|
| Domain for DID-based routing. | Auto-detected |
| Domain for SLP (Service Location Protocol). | Auto-detected |
| Domain for the admin dashboard. | Auto-detected |
| Host for downloading wildcard certificates. |
|
| Enable SLP domain support. Set to |
|
| Enable IPv6 support. Set to |
|
| Force intranet mode. Set to |
|
| Router provider implementation. |
|
| Path to an additional router configuration file. | None |
External Services#
Configure endpoints for external services that Blocklet Server interacts with.
Variable | Purpose | Default |
|---|---|---|
| URL for the web wallet service. |
|
| DID registry endpoint. |
|
| DID of the launcher service. | Auto-configured |
| Address for node registration. | Auto-detected |
| Hostname for the event hub. |
|
Development and Testing#
Variables primarily used for development, testing, and debugging purposes.
Variable | Purpose | Default / Notes |
|---|---|---|
| Skip version compatibility checks. Set to |
|
| DNS server for testing. | None |
| Minimum consecutive time for test runs in milliseconds. |
|
| Mock DID names for testing (comma-separated). | None |
| Use fake disk information for testing. Set to |
|
System-Generated Variables#
These variables are set automatically by the system at runtime. You should not configure them manually as their values are derived from the system's state and context.
Variable | Purpose |
|---|---|
| Name of the CLI binary. |
| Name of the CLI command being executed. |
| NPM package name for the server. |
| Version of the Blocklet Server. |
| Flag indicating component restart status. |
| NFT holder information for ownership. |
| NFT issuer information for ownership. |
| Current blocklet mode. |
| Current kernel mode. |
Security Considerations#
When configuring your Blocklet Server, keep the following security best practices in mind:
- Secure Secrets: Always use strong, randomly generated values for secret keys like
ABT_NODE_SESSION_SECRETandABT_NODE_SK. - Limit Access: Restrict file system access to the data directory and any configuration files to authorized users only.
- Use Management Tools: For production deployments, consider using a dedicated tool for managing environment variables to avoid exposing secrets in shell history or plain text files.