Skip to main content

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:

  1. Default Values

    The built-in default settings for the server.

  2. Configuration File

    Settings defined in your config.yml file.

  3. 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.

VariablePurposeDefault
ABT_NODE_PORTMain port where the Blocklet Server daemon listens.8089
ABT_NODE_SERVICE_PORTPort for internal service communication.40404
ABT_NODE_BLOCKLET_PORTStarting port for blocklet applications.8090
ABT_NODE_HTTP_PORTHTTP port for the gateway/router.80
ABT_NODE_HTTPS_PORTHTTPS port for the gateway/router.443
ABT_NODE_ROUTER_HTTP_PORTHTTP port specifically for the router provider.Same as ABT_NODE_HTTP_PORT
ABT_NODE_ROUTER_HTTPS_PORTHTTPS port specifically for the router provider.Same as ABT_NODE_HTTPS_PORT
ABT_NODE_UPDATER_PORTPort for the updater service.40405
ABT_NODE_EVENT_PORTPort for event hub communication.40407
ABT_NODE_HOSTHost address for the server to bind to.0.0.0.0

Authentication and Security

Manage access control, sessions, DIDs, and security policies.

VariablePurposeDefault / Notes
ABT_NODE_DIDDecentralized Identifier for the server instance.System-generated
ABT_NODE_PKPublic key for the server's DID.System-generated
ABT_NODE_SKSecret key for the server's DID.System-generated (keep secure)
ABT_NODE_SESSION_SECRETSecret key for session encryption.System-generated
ABT_NODE_TOKEN_SECRETSecret key for JWT token signing.System-generated
ABT_NODE_SESSION_TTLSession time-to-live in seconds.3600 (1 hour)
ABT_NODE_SESSION_CACHE_TTLSession cache time-to-live in seconds.300 (5 minutes)
ABT_NODE_ADMIN_PATHPath prefix for the admin dashboard./.well-known/service/admin
ABT_NODE_IP_WHITELISTComma-separated list of IP addresses allowed to access admin.None (all IPs allowed)
ABT_NODE_DOMAIN_WHITELISTComma-separated list of domains allowed for CORS.None
ABT_NODE_DOMAIN_BLACKLISTComma-separated list of domains to block.None
ABT_NODE_DOMAIN_WHITELIST_HEADERSAdditional headers to include in CORS whitelist responses.None
ABT_NODE_NO_PASSKEY_USER_VERIFYDisable passkey user verification. Set to 1 to disable.0 (enabled)

Database and Storage

Configure database connections and caching mechanisms.

VariablePurposeDefault / Notes
ABT_NODE_POSTGRES_URLPostgreSQL connection URL.Uses SQLite if not specified.
ABT_NODE_CACHE_SQLITE_PATHPath to SQLite cache database file.{DATA_DIR}/core/db-cache.db
ABT_NODE_CACHE_REDIS_URLRedis connection URL for caching.None (uses in-memory cache)
ABT_NODE_SQLITE_LARGE_CACHEEnable large cache for SQLite. Set to 1 to enable.0 (disabled)
ABT_NODE_NO_CACHEDisable caching entirely. Set to 1 to disable.0 (enabled)
ABT_NODE_IGNORE_USE_POSTGRESForce use of SQLite even if PostgreSQL is configured. Set to 1.0
ABT_NODE_IGNORE_RESTART_POSTGRESSkip restarting PostgreSQL during startup. Set to 1.0

Docker Configuration

Customize the behavior of blocklets that run in Docker containers.

VariablePurposeDefault
ABT_NODE_NOT_ALLOW_DOCKERDisable Docker support entirely. Set to 1 to disable.0 (enabled)
ABT_NODE_DOCKER_MEMORYDefault memory limit for Docker containers.512m
ABT_NODE_DOCKER_CPUSDefault CPU limit for Docker containers.1
ABT_NODE_DOCKER_DISK_SIZEDefault disk size limit for Docker containers.10g
ABT_NODE_SKIP_DOCKER_CHOWNSkip chown operations in Docker containers. Set to 1 to skip.0
ABT_NODE_TEST_DOCKEREnable Docker testing mode. Set to 1 to enable.0

Logging and Debugging

Control logging levels, locations, and enable debugging modes.

VariablePurposeDefault / Values
ABT_NODE_LOG_DIRDirectory for log files.{DATA_DIR}/logs/_abtnode
ABT_NODE_LOG_NAMEName of the log file.daemon
ABT_NODE_LOG_LEVELLogging level.info (Values: error, warn, info, debug)
ABT_NODE_DEBUG_AS_SERVERLESSEnable serverless debugging mode. Set to 1 to enable.0
ABT_NODE_DEV_MODEEnable development mode with additional debugging. Set to 1 to enable.0

Performance and Limits

Tune performance parameters and set operational limits.

VariablePurposeDefault
ABT_NODE_MAX_CLUSTER_SIZEMaximum number of cluster instances.4
ABT_NODE_JOB_BACKOFF_SECONDSBackoff time for job scheduling in seconds.600 (10 minutes)
ABT_NODE_BLACKLIST_REFRESH_INTERVALInterval for refreshing blacklist in minutes.2
ABT_NODE_EMAIL_RATE_LIMITRate limit for email operations per minute.10
ABT_NODE_EMAIL_VERIFY_RATE_LIMITRate limit for email verification per minute.5
ABT_NODE_ENSURE_RUNNING_CHECK_INTERVALInterval for checking running blocklets in milliseconds.30000 (30 seconds)
ABT_NODE_ENSURE_RUNNING_HIGH_LOAD_CPUCPU threshold (%) for high load detection.80
ABT_NODE_ENSURE_RUNNING_HIGH_LOAD_MEMORYMemory threshold (%) for high load detection.80
ABT_NODE_ENSURE_RUNNING_HIGH_LOAD_DISKDisk threshold (%) for high load detection.90
ABT_NODE_ENABLE_ENSURE_BLOCKLET_RUNNINGEnable automatic blocklet running assurance. Set 0 to disable.1

Domain and Routing

Configure how Blocklet Server handles domains, certificates, and routing.

VariablePurposeDefault / Values
ABT_NODE_DID_DOMAINDomain for DID-based routing.Auto-detected
ABT_NODE_SLP_DOMAINDomain for SLP (Service Location Protocol).Auto-detected
ABT_NODE_DASHBOARD_DOMAINDomain for the admin dashboard.Auto-detected
ABT_NODE_WILDCARD_CERT_HOSTHost for downloading wildcard certificates.https://releases.arcblock.io/certs
ABT_NODE_ENABLE_SLP_DOMAINEnable SLP domain support. Set to 1 to enable.0
ABT_NODE_ENABLE_IPV6Enable IPv6 support. Set to 1 to enable.0
ABT_NODE_FORCE_INTRANETForce intranet mode. Set to 1 to enable.0
ABT_NODE_ROUTER_PROVIDERRouter provider implementation.nginx (Values: nginx, nodejs)
ABT_NODE_ROUTER_CONFIGPath to an additional router configuration file.None

External Services

Configure endpoints for external services that Blocklet Server interacts with.

VariablePurposeDefault
ABT_NODE_WEB_WALLET_URLURL for the web wallet service.https://web.abtnetwork.io
ABT_NODE_DID_REGISTRYDID registry endpoint.https://registry.arcblock.io
ABT_NODE_LAUNCHER_DIDDID of the launcher service.Auto-configured
ABT_NODE_BLOCKLET_LAUNCHER_URLAddress for node registration.Auto-detected
ABT_NODE_EVENT_HOSTNAMEHostname for the event hub.localhost

Development and Testing

Variables primarily used for development, testing, and debugging purposes.

VariablePurposeDefault / Notes
ABT_NODE_SKIP_VERSION_CHECKSkip version compatibility checks. Set to 1 to skip.0
ABT_NODE_TEST_DNS_SERVERDNS server for testing.None
ABT_NODE_TEST_MIN_CONSECUTIVE_TIMEMinimum consecutive time for test runs in milliseconds.1000
ABT_NODE_MOCK_DID_NAMESMock DID names for testing (comma-separated).None
ABT_NODE_FAKE_DISK_INFOUse fake disk information for testing. Set to 1 to enable.0

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.

VariablePurpose
ABT_NODE_BINARY_NAMEName of the CLI binary.
ABT_NODE_COMMAND_NAMEName of the CLI command being executed.
ABT_NODE_PACKAGE_NAMENPM package name for the server.
ABT_NODE_VERSIONVersion of the Blocklet Server.
ABT_NODE_RESTART_RUNNING_COMPONENTFlag indicating component restart status.
ABT_NODE_OWNER_NFT_HOLDERNFT holder information for ownership.
ABT_NODE_OWNER_NFT_ISSUERNFT issuer information for ownership.
ABT_NODE_BLOCKLET_MODECurrent blocklet mode.
ABT_NODE_KERNEL_MODECurrent 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_SECRET and ABT_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.