Overview

Customise your Blnk server with our robust configuration system. This configuration is set via the blnk.json file or environment variables with the prefix, BLNK_.


Configuration Structure

Server Configuration

The server configuration module provides a centralized way to define your server’s behavior and security settings..

{
  "server": {
    "ssl": false,                  
    "secure": false,               
    "secret_key": "",          
    "domain": "",              
    "email": "",               
    "port": "5001"             
  }
}
AttributeTypeDescriptionEnvironment variables
sslbooleanControls SSL/TLS encryption for secure communications. When enabled, the server will require HTTPS connections and handle SSL certificate management.BLNK_SERVER_SSL
securebooleanEnables enhanced security mode with additional protection mechanisms such as strict HTTP headers, CORS policies, and request validation.BLNK_SERVER_SECURE
secret_keystringUsed for session encryption, token signing, and other cryptographic operations. Should be a strong, unique value in production.BLNK_SERVER_SECRET_KEY
domainstringSpecifies the domain name for SSL certificate configuration and cookie settings. Required when SSL is enabled.BLNK_SERVER_SSL_DOMAIN
emailstringContact email address for SSL certificate registration and notifications. Required for automated SSL certificate management.BLNK_SERVER_SSL_EMAIL
portstringThe network port on which the server listens for incoming connections.BLNK_SERVER_PORT

PII Tokenization

This configuration ensures that sensitive data is encrypted and protected during tokenization and detokenization operations.

{
  "tokenization_secret": ""
}
AttributeTypeDescriptionEnvironment variables
tokenization_secretstringSecret key used to secure the tokenization process.BLNK_TOKENIZATION_SECRET

Database Configuration

The data source configuration establishes the connection between the Blnk server and your database backend.

{
  "data_source": {
    "dns": ""                      
  }
}
AttributeTypeDescriptionEnvironment variables
dnsstringThe database connection string that specifies the location, credentials, and parameters for connecting to your database. Required for server startup.BLNK_DATA_SOURCE_DNS
The DNS string typically follows this pattern: [driver]://[username]:[password]@[host]:[port]/[database]

Redis Configuration

The Redis configuration manages the connection to your Redis instance, which is commonly used for caching, session storage, and message queuing.

{
  "redis": {
    "dns": ""                     
  }
}
AttributeTypeDescriptionEnvironment variables
dnsstringThe Redis connection string that specifies the host, port, and authentication details for your Redis instance. Required for Redis functionality.BLNK_REDIS_DNS
The DNS string typically follows this pattern: redis://[[username:]password@]host[:port][/database]

Typesense Configuration

The TypeSense configuration manages your connection to the TypeSense search engine, enabling fast and typo-tolerant search functionality in your Blnk server.

{
  "typesense": {
    "dns": ""                         
  },
  "type_sense_key": ""               
}
AttributeTypeDescriptionEnvironment variables
dnsstringThe URL endpoint for your TypeSense server instance. Specifies the host and port for the TypeSense connection.BLNK_TYPESENSE_DNS
type_sense_keystringThe API key used for authenticating requests to your TypeSense instance. Required for secure access to the search engine.BLNK_TYPESENSE_KEY

Rate Limiting

The rate limiting configuration helps protect the API from abuse and ensures fair resource allocation.

{
  "rate_limit": {
    "requests_per_second": null,     
    "burst": null,                   
    "cleanup_interval_sec": 10800    
  }
}
AttributeTypeDescriptionEnvironment variables
requests_per_secondnumber/nullMaximum number of requests allowed per second per client. When null, no RPS limit is applied.BLNK_RATE_LIMIT_RPS
burstnumber/nullMaximum number of requests allowed to exceed the RPS limit in short bursts. When null, no burst limit is applied.BLNK_RATE_LIMIT_BURST
cleanup_interval_secnumberInterval in seconds for cleaning up expired rate limit data. Defaults to 3 hours (10800 seconds).BLNK_RATE_LIMIT_CLEANUP_INTERVAL_SEC

Transaction Configuration

The transaction configuration manages how Blnk processes and handles batched operations, controlling throughput and resource utilization.

{
  "transaction": {
    "batch_size": 100000,                
    "max_queue_size": 1000,              
    "max_workers": 10,                   
    "lock_duration": 1800,               
    "index_queue_prefix": "transactions" 
  }
}
AttributeTypeDescriptionEnvironment variables
batch_sizenumber/nullMaximum number of items to process in a single transaction batch.BLNK_TRANSACTION_BATCH_SIZE
max_queue_sizenumber/nullMaximum number of transactions that can be queued for processing.BLNK_TRANSACTION_MAX_QUEUE_SIZE
max_workersnumberMaximum number of concurrent workers processing transactions.BLNK_TRANSACTION_MAX_WORKERS
lock_durationnumberDuration for which a transaction lock is held. Format: seconds.BLNK_TRANSACTION_LOCK_DURATION
index_queue_prefixstringPrefix used for the transaction queue names in the indexing system.BLNK_TRANSACTION_INDEX_QUEUE_PREFIX

Reconciliation Configuration

The reconciliation configuration handles how the reconciliation engine works.

{
  "reconciliation": {
    "default_strategy": "one_to_one",     
    "progress_interval": 100,             
    "max_retries": 3,                     
    "retry_delay": 5                      
  }
}
AttributeTypeDescriptionEnvironment variables
default_strategystringDefines the default matching strategy for reconciliation. Options are one_to_one, one_to_many, many_to_one.BLNK_RECONCILIATION_DEFAULT_STRATEGY
progress_intervalnumberNumber of records to process before emitting a progress update.BLNK_RECONCILIATION_PROGRESS_INTERVAL
max_retriesnumberMaximum number of retry attempts for failed reconciliation operations.BLNK_RECONCILIATION_MAX_RETRIES
retry_delaystringTime to wait between retry attempts. Format: seconds.BLNK_RECONCILIATION_RETRY_DELAY

Queue Configuration

The queue configuration defines the various queues used throughout the server for processing different types of operations asynchronously.

{
  "queue": {
    "transaction_queue": "new:transaction",             
    "webhook_queue": "new:webhook",                     
    "index_queue": "new:index",                         
    "inflight_expiry_queue": "new:inflight-expiry",     
    "number_of_queues": 20,
    "insufficient_fund_retries": true,
    "max_retry_attempts": 3                           
  }
}
AttributeTypeDescriptionEnvironment variables
transaction_queuestringQueue name for processing transaction operations.BLNK_QUEUE_TRANSACTION
webhook_queuestringQueue name for handling webhook event delivery.BLNK_QUEUE_WEBHOOK
index_queuestringQueue name for managing search index updates.BLNK_QUEUE_INDEX
inflight_expiry_queuestringQueue name for tracking and processing in-flight operation timeouts.BLNK_QUEUE_INFLIGHT_EXPIRY
number_of_queuesnumberTotal number of queue workers to maintain across all queue types.BLNK_QUEUE_NUMBER_OF_QUEUES
insufficient_fund_retriesbooleanDetermines whether the ledger should automatically retry transactions that fail due to insufficient funds.BLNK_QUEUE_INSUFFICIENT_FUND_RETRIES
max_retry_attemptsnumberSpecifies the maximum number of retry attempts before the transaction with insufficient funds is rejected.BLNK_QUEUE_MAX_RETRY_ATTEMPTS

Notification Configuration

The notification configuration manages external integrations for system notifications, including Slack alerts and custom webhooks.

{
  "notification": {
    "slack": {
      "webhook_url": ""
    },
    "webhook": {
      "url": "",
      "headers": {}     
    }
  }
}
AttributeTypeDescriptionEnvironment variables
slack.webhook_urlstringSlack webhook URL for sending notifications to specific channels.BLNK_SLACK_WEBHOOK_URL
webhook.urlstringEndpoint URL where webhook notifications will be sent.BLNK_WEBHOOK_URL
webhook.headersobjectCustom HTTP headers to be included with webhook requests.BLNK_WEBHOOK_HEADERS

S3 Configuration

The S3 configuration manages connection settings for Amazon S3 storage service for system backups and file storage.

{
  "backup_dir": "",                      
  "aws_access_key_id": "",
  "aws_secret_access_key": "",
  "s3_endpoint": "",
  "s3_bucket_name": "",
  "s3_region": ""
}
AttributeTypeDescriptionEnvironment variables
backup_dirstringDirectory path where backups will be stored in S3.BLNK_BACKUP_DIR
aws_access_key_idstringAWS access key ID for authentication.BLNK_AWS_ACCESS_KEY_ID
aws_secret_access_keystringAWS secret access key for authentication.BLNK_AWS_SECRET_ACCESS_KEY
s3_endpointstringCustom endpoint URL for S3-compatible services. Leave empty for default AWS S3.BLNK_S3_ENDPOINT
s3_bucket_namestringName of the S3 bucket to use for storage.BLNK_S3_BUCKET_NAME
s3_regionstringAWS region where the S3 bucket is located (e.g., “us-east-1”).BLNK_S3_REGION

Default Values & Validation

Required Fields

  • Data Source DNS (data_source.dns)
  • Redis DNS (redis.dns)

Automatic Defaults

  1. Project name defaults to “Blnk Server”
  2. Server port defaults to “5001”
  3. TypeSense URL defaults to “http://typesense:8108
  4. Rate limiting:
    • If RPS is set without burst, burst defaults to 2 * RPS
    • If burst is set without RPS, RPS defaults to burst / 2
    • Cleanup interval defaults to 10800 seconds (3 hours)
  5. Telemetry is enabled by default

Transaction Defaults

  • Batch size: 100,000
  • Max queue size: 1,000
  • Max workers: 10
  • Lock duration: 1800 seconds
  • Index queue prefix: “transactions”

Reconciliation Defaults

  • Default strategy: “one_to_one”
  • Progress interval: 100
  • Max retries: 3
  • Retry delay: 5 seconds

Queue Defaults

  • Transaction queue: “new:transaction”
  • Webhook queue: “new:webhook”
  • Index queue: “new:index”
  • Inflight expiry queue: “new:inflight-expiry”
  • Number of queues: 20
  • Insufficient retries: false

Configuration Loading Process

  1. Load configuration from JSON file if present.
  2. Override with environment variables.
  3. Validate required fields.
  4. Apply default values.
  5. Trim whitespace from string values.
  6. Setup rate limiting defaults.

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool.

To ask questions or discuss issues, please contact us or join our Discord community.

Sign up on Blnk Cloud

Connect your Blnk Ledger and explore advanced features (access control & collaboration, anomaly detection, secure storage & file management, etc.) in one intuitive dashboard.