Skip to content

Configuration

1. Biến môi trường

Nguồn: packages/core/src/common/environments.ts + packages/pricing/src/common/keys.ts.

Core

TênKiểuMặc địnhBắt buộcPhạm viMô tả
APP_ENV_PORTnumber3000runtimeCổng HTTP lắng nghe (ngoài 31070 ở dev)
APP_ENV_HOSTstring0.0.0.0runtimeHost bind
APP_ENV_BASE_PATHstring/v1/api/pricingruntimeTiền tố route
APP_ENV_NODE_IDnumber7runtimeSnowflake worker ID
APP_ENV_LOG_LEVELinfo|debug|warn|errorinforuntimeMức logger

Database

TênKiểuMặc địnhBắt buộcMô tả
APP_ENV_DB_URLstringURL kết nối PostgreSQL (schema pricing)

Redis / Kafka

TênKiểuMặc địnhBắt buộcMô tả
APP_ENV_REDIS_HOST / APP_ENV_REDIS_PORTstring / number— / 6379Chỉ cache permission authorization
APP_ENV_KAFKA_BROKERSstringBrokers ngăn cách bằng dấu phẩy; binding throw nếu rỗng
APP_ENV_KAFKA_CLIENT_IDstringPRICING_PRODUCER / PRICING_CONSUMERClient id producer/consumer
APP_ENV_KAFKA_GROUP_IDstringPRICING_CONSUMER_GROUPCDC consumer group
APP_ENV_KAFKA_SASL_ENABLEstring ('true')chưa đặtBật khối SASL bên dưới
APP_ENV_KAFKA_SASL_MECHANISM / _USERNAME / _PASSWORDstringNACredential SASL (chỉ khi bật)

Riêng service

TênKiểuMặc địnhBắt buộcMô tả
APP_ENV_DEFAULT_TAX_RATEstringKhai báo trong PricingEnvironmentKeys nhưng không dùng — không calculator nào đọc nó

Sale (caller) cần APP_ENV_PRICING_SERVICE_BASE_URL + APP_ENV_BASIC_AUTH_USERNAME/PASSWORD để tới pricing. Những cái đó nằm trong config của sale, không phải pricing.

2. Feature Flags

Không. Không có runtime feature flag. Tách v1/v2 là phân biệt route ở tầng code (/simulation vs /simulation-v2), không phải một flag.

3. Dữ liệu seed

Các process migration ở src/migrations/processes/alwaysRun: true, idempotent, chạy lúc bootstrap (mode migrate).

FileSeedIdempotentGhi chú
pricing-0001-seed-permissions.tsPricingPermissions (permission resource theo từng controller)Upsert theo code (create hoặc update)
pricing-0002-seed-role-permissions.tsGrant TẤT CẢ permission pricing cho OWNER, EMPLOYEE, CASHIERBaseline rộng — siết theo role sau qua API policy-definition merchant

CDC worker cũng "seed" FareSet/Fare lúc runtime, nhưng đó là nạp dữ liệu (xem API Events), không phải migration.

4. Lưu trữ Configuration (bảng Configuration)

Không dùng. Pricing không giữ credential mã hoá theo merchant hay hàng config runtime nào.

5. Trang liên quan

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