Skip to content

Configuration

1. Environment Variables

Source: packages/core/src/common/environments.ts + this package's certificate keys. The licensing service reads core's standard application/DB/Redis/auth env set; only the certificate keys are package-specific.

Application

NameTypeDefaultRequiredDescription
APP_ENV_APPLICATION_NAMEstringlicensingService name
APP_ENV_APPLICATION_CODEstringSVC-00140-LICENSINGService code (reassigned from SVC-00110; see ADR-0002)
APP_ENV_APPLICATION_SECRETstring✓ (for certs)AES-256-GCM secret for certificate payload encryption
APP_ENV_SERVER_HOSTstringlocalhostBind host
APP_ENV_SERVER_PORTnumber31120HTTP listen port
APP_ENV_SERVER_BASE_PATHstring/v1/api/licensingRoute prefix
APP_ENV_SNOWFLAKE_WORKER_IDnumber11Snowflake worker ID

Database

NameTypeRequiredDescription
APP_ENV_POSTGRES_HOST / _PORT / _DATABASE / _USERNAME / _PASSWORDstringPostgreSQL connection (PostgresCoreDataSource)

Redis (cache component)

NameTypeDefaultDescription
APP_ENV_CACHE_REDIS_MODEsingle | clusterConnection mode
APP_ENV_CACHE_REDIS_IDENTIFIERstringcacheLogical identifier
APP_ENV_CACHE_REDIS_HOST / _PORTstring / numberSingle-mode endpoint
APP_ENV_CACHE_REDIS_CLUSTER_NODESstringComma-separated host:port (cluster mode)
APP_ENV_CACHE_REDIS_PASSWORDstringRedis password

No Kafka or BullMQ env is consumed — those components are not registered.

Auth

NameTypeDescription
APP_ENV_IDENTITY_SERVICE_BASE_URLstringIdentity base URL for JWKS verification
APP_ENV_JWKS_REST_PATHstringJWKS endpoint path
APP_ENV_BASIC_AUTH_USERNAME / _PASSWORDstringHTTP Basic credentials (alternate auth strategy)

Service-specific — Certificates

NameTypeDefaultRequiredDescription
APP_ENV_LICENSING_ED25519_PRIVATE_KEYstring (PEM)✓ (to sign)Ed25519 private key for signing certificates
APP_ENV_LICENSING_ED25519_PUBLIC_KEYstring (PEM)✓ (consumers verify)Ed25519 public key — shipped to verifier services via @nx/core
APP_ENV_LICENSING_CERT_TTL_SECONDSnumber86400Cert TTL → both Redis EX and payload certExpiresAt
APP_ENV_LICENSING_SERVICE_BASE_URLstringDefined in core env registry; not used at runtime (consumers read the cached cert, not the service)

Graceful degradation: if APP_ENV_LICENSING_ED25519_PRIVATE_KEY or APP_ENV_APPLICATION_SECRET is missing, publishCertificate() logs a warning and skips cert generation. Licenses still issue, but License.certificate stays null and consumers receive null from LicenseMiddleware.

2. Feature Flags

FlagDefaultOwnerDescription
NoneNo runtime feature flags. PolicyFeature entitlements are domain data, not deployment flags.

3. Seeded Data

Migration processes in src/migrations/processes/ — all alwaysRun: true (idempotent upserts) on bootstrap (RUN_MODE=migrate).

FileSeedsIdempotentNotes
licensing-0001-seed-permissions.tsAll LicensingPermissions (CRUD on 4 subjects + license lifecycle actions)Upserts each permission by code
licensing-0002-seed-free-trial-plan.ts1 Policy (FREE_TRIAL: TRIAL, 30-day, ACTIVATED, product Trial)Upserts by (product, type, status)
licensing-0003-seed-role-permissions.tsGrants ALL licensing permissions to OWNER, EMPLOYEE, CASHIERLenient baseline — tightened later via policy-definition API
licensing-0004-seed-guest-permissions.tsGrants License.issueFreeTrial to GUEST (wildcard domain *)Pre-merchant onboarding self-service trial

4. Configuration Storage (Configuration table)

Configuration kindEncryptionRead by
NoneLicensing does not use the per-merchant Configuration table. Certificate secrets come from env, not encrypted runtime config.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.