Configuration
1. Environment Variables
Source:
EnvironmentKeysin@nx/core/src/common/environments.ts. Service reads viaapplicationEnvironment.get<T>(key).
Core runtime
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
APP_ENV_PORT | number | 3000 | HTTP listen port (container) | |
APP_ENV_HOST | string | 0.0.0.0 | Bind address | |
APP_ENV_BASE_PATH | string | /v1/api/sale | Route prefix | |
APP_ENV_NODE_ID | number | — | ✓ | Snowflake worker ID — must be 3 for sale |
APP_ENV_LOG_LEVEL | info|debug|warn|error | info | Logger level | |
APP_ENV_NODE_ENV | string | development | Loaded via dotenv-flow | |
RUN_MODE | migrate|server | migrate switches to migration entry |
Database
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
APP_ENV_DB_URL | string | — | ✓ | PostgreSQL connection URL |
APP_ENV_DB_POOL_MAX | number | 10 | Max pool size |
Redis (auth cache only)
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
APP_ENV_REDIS_HOST | string | — | Optional — auth cache disabled when unset | |
APP_ENV_REDIS_PORT | number | 6379 | — | |
APP_ENV_REDIS_PASSWORD | string | — | — | |
APP_ENV_REDIS_DB | number | 0 | — |
Kafka (producer-only)
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
APP_ENV_KAFKA_BROKERS | csv | — | ✓ | Comma-separated broker list |
APP_ENV_KAFKA_CLIENT_ID | string | SVC-00030-SALE_PRODUCER | Producer client id | |
APP_ENV_KAFKA_SASL_ENABLE | 'true'|'false' | false | Toggle SASL auth | |
APP_ENV_KAFKA_SASL_MECHANISM | enum | NA | When SASL enabled | |
APP_ENV_KAFKA_SASL_USERNAME | string | NA | When SASL enabled | |
APP_ENV_KAFKA_SASL_PASSWORD | string | NA | When SASL enabled |
Sale registers a Producer only — there is no Kafka consumer in this package.
Authentication
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
APP_ENV_JWKS_URL | url | — | ✓ | Identity service JWKS endpoint |
APP_ENV_BASIC_AUTH_* | string | — | Service-to-service basic creds |
Sister-service network
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
APP_ENV_PRICING_BASE_URL | url | — | ✓ | @nx/pricing HTTP base for PricingNetworkService |
APP_ENV_COMMERCE_BASE_URL | url | — | ✓ | @nx/commerce HTTP base (cross-package reads) |
2. Feature Flags
No global feature flags today. Cancellation policy / pricing v2 toggle live in per-merchant
Configurationrows (see §4).
3. Seeded Data
Migration processes in
src/migrations/processes/. Run on bootstrap (prestart→bun run rebuild→migrate.ts).
| File | Scope | Idempotency Key | Notes |
|---|---|---|---|
sale-0001-seed-permissions.ts | Permission (RBAC catalogue) | code | Aggregates all sale permission groups (controllers/permissions.ts) |
sale-0002-create-pos-session-report.ts | DB schema bootstrap for PosSessionReport | n/a (DDL) | Creates the report table if missing — separate from main migration runner |
4. Configuration Storage (Configuration table)
| Configuration kind | Encryption | Read by |
|---|---|---|
| Per-merchant payment provider credentials (read-only here) | AES-256-GCM (encrypt by @nx/payment) | PaymentWebhookService (rare — most reads happen at MQ-Pay; sale primarily uses webhook payload) |
| Loyalty point conversion rate per merchant | — | CustomerPointService.awardPointsForOrder |
Sale reads from
Configuration; writes are owned by the issuing service (e.g., payment).
5. Boot Order
6. Related Pages
- Operations — deployment + observability
- API Events — Kafka topic constants
- Decisions