Documentation menu

Configuration

Qirsh is configured with environment variables, read from .env (Node) or env_file (Docker). This page lists every variable that src/config.ts accepts, and a test checks that it stays complete. .env.example has the same variables with comments.

The server validates everything at start and exits with a message naming each bad variable, for example API_SECRET_KEY: must be at least 24 characters. Booleans accept true, false, 1, 0 or empty (false).

Server

Variable Default Description
PORT 8080 Port to listen on
HOST 0.0.0.0 Address to bind. Use 127.0.0.1 on a bare-metal install behind a proxy. Docker publishes the port on localhost only
PUBLIC_URL http://localhost:8080 The public base URL. Used for checkout_url; an https:// URL also makes the session cookie Secure
DATABASE_PATH ./data/qirsh.db SQLite file. Docker sets /data/qirsh.db
TRUST_PROXY false Trust X-Forwarded-For from a reverse proxy. Only behind a proxy you control
LOG_LEVEL info fatal, error, warn, info, debug, trace or silent

Dashboard

Variable Default Description
ADMIN_EMAIL Email of the first admin, created at start if no admin exists. Set together with ADMIN_PASSWORD
ADMIN_PASSWORD Password of that admin, 12 characters or more
SESSION_TTL_HOURS 12 Dashboard sign-in lifetime, 1 to 720 hours
BRAND_NAME Qirsh Gateway name on the dashboard, landing page and legal pages. Checkouts show each project's own name
BRAND_COLOR #007a3d Gateway colour, #rrggbb (the default is Palestinian green). Checkouts use each project's own colour

Projects and invoices

Variable Default Description
NETWORK nile Default network for new projects and the network of the single-store project: mainnet, nile or shasta
INVOICE_TTL_MINUTES 30 Default invoice lifetime, 5 to 1440. Projects and single invoices can override it
UNIQUE_AMOUNT_SLOTS 9999 How many distinct unique-amount offsets exist per base amount and wallet, 10 to 999999. The default adds at most 0.009999 USDT
ALLOW_PRIVATE_WEBHOOKS false Allow dashboard projects to use webhook URLs on localhost or private networks. Development only. The env project is always allowed

Single-store project

Setting MERCHANT_ADDRESS creates a project called Default from these variables and keeps it in sync on every start. See Concepts.

Variable Default Description
MERCHANT_ADDRESS Wallet that receives payments: a TRON address you control, not an exchange deposit address
API_SECRET_KEY The project's API key, 24 characters or more (openssl rand -hex 32). Requires MERCHANT_ADDRESS
WEBHOOK_URL Where the project's webhooks go
WEBHOOK_SECRET Signing secret, 24 characters or more. Required when WEBHOOK_URL is set
ALLOW_SIMULATION false Allow simulate-payment for this project. Refused when NETWORK=mainnet
DEPOSIT_MODE amount amount or forwarder. Forwarder needs a fee key and a factory for NETWORK. Applies to the single-store project. Dashboard projects start in forwarder mode when their network supports it, else unique amount, and can be switched in their settings

Chain access and token

Variable Default Description
TRONGRID_API_KEY TronGrid API key. Used for mainnet only; strongly recommended there
TRONGRID_API_URL TronGrid URL of NETWORK Use another TronGrid-compatible endpoint for the default network
POLL_INTERVAL_SECONDS 10 How often the watcher polls, 3 to 300
TOKEN_CONTRACT USDT of NETWORK Accept another TRC-20 token on the default network
TOKEN_SYMBOL USDT Symbol shown for that token
TOKEN_DECIMALS 6 Decimals of that token, 0 to 18

The token variables apply to NETWORK only. Projects on other networks always use USDT.

Forwarder mode

All optional. Unique-amount mode needs none of them. See the operator guide for the setup.

Variable Default Description
FEE_PAYER_PRIVATE_KEY_FILE Path to a file with the fee wallet's private key (64 hex characters). Preferred
FEE_PAYER_PRIVATE_KEY The key itself. Set this or the _FILE form, never both. Never a merchant wallet's key
FEE_PAYER_PRIVATE_KEY_FILE_MAINNET Key file used only for mainnet. Overrides the general key there
FEE_PAYER_PRIVATE_KEY_FILE_NILE Key file used only for Nile. Overrides the general key there
FEE_PAYER_PRIVATE_KEY_FILE_SHASTA Key file used only for Shasta. Overrides the general key there
FORWARDER_FACTORY_MAINNET Factory contract on mainnet. Verified on-chain before any address is derived from it
FORWARDER_FACTORY_NILE Factory contract on Nile
FORWARDER_FACTORY_SHASTA Factory contract on Shasta
SWEEP_FEE_LIMIT_TRX 50 Hard cap on the fee of one sweep transaction, 1 to 1000 TRX
SWEEP_MIN_AMOUNT 1 In token units. Smallest balance swept without an admin's force, and the smallest forwarder invoice (400 amount_too_small below it)
SWEEP_STRAY_MIN_AMOUNT 10 Balances that did not pay an invoice (partial, late, extra) are swept automatically only from this amount. Must be at least SWEEP_MIN_AMOUNT
SWEEP_PROJECT_DAILY_BUDGET_TRX 1000 Rolling 24-hour cap on sweep fees per project. 0 means no cap
FORWARDER_MAX_OPEN_INVOICES 2000 Open forwarder invoices per project, 1 to 1000000. Above it, creation answers 503 too_many_open_invoices
FEE_WALLET_MIN_TRX 100 The dashboard and logs warn when the fee wallet holds less

Each network signs with its own key file when FEE_PAYER_PRIVATE_KEY_FILE_<NETWORK> is set, and with the general key (FEE_PAYER_PRIVATE_KEY or FEE_PAYER_PRIVATE_KEY_FILE) otherwise. TRON transactions carry no chain id, so a key that signs for a testnet can be tricked into signing transactions that are valid on mainnet. With one key file per network, one instance can serve mainnet and Nile without sharing a key. Separate instances per network are still the simplest setup.

Network fees

All optional. With no collector, no fee is charged. See Network fees.

Variable Default Description
FEE_COLLECTOR_ADDRESS The operator's wallet that receives sweep fees (USDT), on every network. Its key must not be on the server. Unset means no fees
FEE_COLLECTOR_ADDRESS_MAINNET Collector for mainnet. Overrides FEE_COLLECTOR_ADDRESS there
FEE_COLLECTOR_ADDRESS_NILE Collector for Nile
FEE_COLLECTOR_ADDRESS_SHASTA Collector for Shasta
SWEEP_FEE_DEFAULT 0 Fee per forwarder invoice, in token units (for example 1.5), for projects that have not set their own sweep_fee. 0 charges nothing
TRX_USDT_RATE What one TRX costs in the token, for example 0.28. Only used by the dashboard to recommend a fee and to compare fees collected with TRX spent. An admin can override it on the Fee wallet tab

Changing any of these affects new invoices only. Each invoice keeps the fee and collector it was created with.

Rules checked at start

Variable Default Description
LANDING_PAGE true Serve the landing page at /. false redirects / to /admin, as older versions did
LEGAL_PAGES true Serve the legal pages at /legal/terms, /legal/privacy, /legal/acceptable-use, /legal/disclaimer, /legal/cookies and /legal/payer-notice, with an index at /legal. false answers 404 there and removes the links from the checkout, the sign-in page and the landing page
OPERATOR_NAME value of BRAND_NAME Who runs this instance, as named in the legal pages. A person's name works; no company is needed
OPERATOR_CONTACT Email address or URL for legal and privacy requests. While empty, the pages tell people to contact the operator through the dashboard or the project's GitHub repository
OPERATOR_JURISDICTION Whose laws apply. The pages say "the laws of" followed by this value, so give a place name such as Palestine. While empty, the legal pages show a banner saying the operator has not finished them
LEGAL_EFFECTIVE_DATE Free text shown as the effective date, for example 1 January 2027. While empty, the same banner shows

The legal pages are templates. Have a lawyer review them before you rely on them. The source is in legal/.

Edit this page on GitHub