Skip to content

Cấu hình

Định danh được lấy từ src/resources/app-info.json (qua getAppInfo()), không phải từ .env.development. App config được build bởi createAppConfig() từ @nx/core. Đặt tên env theo quy ước core APP_ENV_*.

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

Định danh (có thẩm quyền vs env)

Thuộc tínhapp-info.json (có thẩm quyền).env.development (cũ)
Application codeSVC-00120-HELPDESKSVC-00120-HELPDESK ✓ đã khớp (trước là SVC-00030-HELPDESK)
Port3113031032
Snowflake node id120
Base path/v1/api/helpdesk/v1/api/helpdesk

Drift định danh. Coi app-info.json là nguồn sự thật. .env.development nên được đối chiếu về SVC-00120 / 31130 / 12 khi build được sửa. Không dựa vào giá trị định danh .env.

Runtime core

TênTypeMặc địnhBắt buộcMô tả
RUN_MODEstartup|worker|migratestartupVai trò process
NODE_ENVstringBộ chọn môi trường
APP_ENV_APPLICATION_CODEstringtừ app-infoNên là SVC-00120-HELPDESK
APP_ENV_SERVER_PORTnumber31130Cổng HTTP lắng nghe
APP_ENV_SERVER_BASE_PATHstring/v1/api/helpdeskTiền tố route
APP_ENV_SNOWFLAKE_WORKER_IDnumber12Snowflake node id
APP_ENV_SNOWFLAKE_EPOCH_CHECKPOINTnumber1735689600000Epoch Snowflake

Cơ sở dữ liệu

TênTypeBắt buộcMô tả
APP_ENV_POSTGRES_*string/numberKết nối Postgres (host/port/db/credentials) qua PostgresCoreDataSource

Redis (cache + BullMQ + WebSocket pubsub)

TênTypeMô tả
APP_ENV_CACHE_REDIS_MODEcluster|standaloneChế độ cache Redis (cluster trong dev)
APP_ENV_CACHE_REDIS_IDENTIFIERstringví dụ cache
APP_ENV_CACHE_REDIS_PASSWORDstringAuth
APP_ENV_CACHE_REDIS_CLUSTER_NODESstringNode cluster host:port phân tách bằng dấu phẩy
APP_ENV_WEBSOCKET_REDIS_*Identifier Redis riêng (ws) cho WebSocket pubsub

Mail (Nodemailer)

TênTypeMô tả
APP_ENV_MAIL_HOSTstringHost SMTP (ví dụ smtp.gmail.com)
APP_ENV_MAIL_PORTnumberví dụ 465
APP_ENV_MAIL_SECUREbooleanTLS
APP_ENV_MAIL_USER / APP_ENV_MAIL_PASSWORDstringCredential SMTP
APP_ENV_MAIL_FROM_NAME / APP_ENV_MAIL_FROM_MAILstringĐịnh danh From
APP_ENV_LOCAL_TEMPLATE_DIRstringThư mục email template (resources/email-templates/default)

Kafka: không có APP_ENV_KAFKA_* nào được tiêu thụ — dep Kafka chết. Xem API Events.

Escalation / routing hỗ trợ

Định nghĩa trong src/shared/common/constants/common.constant.ts (ESCALATION_CONFIG), đọc từ env với fallback.

TênMặc định (fallback)Mô tả
APP_ENV_SUPPORT_MANAGER_EMAILhuy.pham@nexpando.comNgười nhận escalation manager
APP_ENV_SUPPORT_LEADERSHIP_EMAILhuy.pham@nexpando.comNgười nhận leadership (critical)
APP_ENV_SUPPORT_ESCALATION_SLACK#support-escalationsKênh Slack escalation
APP_ENV_SUPPORT_CRITICAL_SLACK#support-critical-escalationsKênh Slack critical

2. Feature Flags

Khai báo trong app-info.json features (cờ năng lực mô tả; không phải kill-switch runtime).

FlagGiá trịNăng lực
ticketingtrueQuản lý ticket
slaManagementtrueTheo dõi SLA + escalation
knowledgeBasetrueArticles + feedback
surveystrueKhảo sát CSAT
analyticstrueAnalytics (tên hàng đợi được dành, không đấu nối worker)
contextEnrichmenttrueEnrichment order/product
autoAssignmenttruePhân công dựa trên rule

3. Hằng số Tinh chỉnh SLA / Worker

Hằng số compile-time trong src/shared/common/constants/common.constant.ts.

Hằng sốGiá trị
WORKER_CONFIG.SLA_MONITOR_INTERVAL*/1 * * * * (mỗi phút)
WORKER_CONFIG.SLA_BATCH_SIZE100
SLA_WARNING_THRESHOLDSYELLOW 75 / ORANGE 90 / RED 100 / CRITICAL 150
SLA_DEFAULTS (theo priority 10/20/30/40/50)phút response/resolution theo từng tier
ESCALATION_TIMINGL1→L2 45m, L2→L3 75m
COMPENSATION_MATRIXtheo tier (STANDARD/PREMIUM/VIP) × severity → số tiền
SYSTEM_ORGANIZER_ID / SYSTEM_MERCHANT_ID0000-0000-0000-0000

4. Dữ liệu Seed

Process migration trong src/migrations/processes/ — chạy qua RUN_MODE=migrate. Email template mặc định ship dưới dạng JSON trong src/resources/email-templates/default/ (vòng đời ticket, cảnh báo/vi phạm SLA, level escalation, phân công, đền bù, after-hours).

NguồnSeedGhi chú
migrations/processes/migration-process.tsProcess migration DrizzleMigration schema (model tập trung trong @nx/core)
resources/email-templates/default/*.json~18 email templateĐược Nodemailer nạp từ thư mục template

5. Lưu trữ Cấu hình

Chính sách SLA theo merchant, rule assignment, preference/template thông báo, và định nghĩa survey được lưu dưới dạng bảng domain trong schema helpdesk (không phải bảng Configuration chung). Xem Domain Model.

6. Trang liên quan

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