From c0bd4760b1575893e36ecc91cb69b64d4089908e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roog=20=28=E9=A1=BE=E6=96=B0=E5=9F=B9=29?= Date: Tue, 3 Feb 2026 15:27:05 +0800 Subject: [PATCH] =?UTF-8?q?main:=E6=9B=B4=E6=96=B0=20.env.example=EF=BC=8C?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=B9=B6=E8=A1=A5=E5=85=85=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 变更内容: - 将原配置项注释翻译为中文,提升可读性。 - 补充 Redis、异步任务、Worker 等相关配置项,为后续功能扩展做好准备。 - 调整文件结构和注释风格,规范化配置文件说明。 --- .env.example | 73 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 0adc4c0..5e84b16 100644 --- a/.env.example +++ b/.env.example @@ -1,32 +1,87 @@ # Environment Configuration # Copy this file to .env and fill in your values -# Application +# ============================================================================= +# 应用信息 +# ============================================================================= APP_NAME=FunctionalScaffold APP_VERSION=1.0.0 APP_ENV=development -# Server +# ============================================================================= +# 服务器配置 +# ============================================================================= HOST=0.0.0.0 PORT=8000 WORKERS=4 -# Logging +# ============================================================================= +# 日志配置 +# ============================================================================= LOG_LEVEL=INFO LOG_FORMAT=json +# 日志文件配置(可选,默认禁用) +LOG_FILE_ENABLED=false +LOG_FILE_PATH=/var/log/app/app.log -# Metrics +# ============================================================================= +# 指标配置 +# ============================================================================= METRICS_ENABLED=true +METRICS_CONFIG_PATH=config/metrics.yaml +# 指标实例 ID(可选,默认使用 hostname) +# METRICS_INSTANCE_ID=my-instance -# Tracing +# ============================================================================= +# 追踪配置 +# ============================================================================= TRACING_ENABLED=false -JAEGER_ENDPOINT=http://localhost:14268/api/traces +# JAEGER_ENDPOINT=http://localhost:14268/api/traces -# External Services (examples) +# ============================================================================= +# Redis 配置 +# ============================================================================= +REDIS_HOST=localhost +REDIS_PORT=6379 +REDIS_DB=0 +REDIS_PASSWORD=your_redis_password + +# ============================================================================= +# 异步任务配置 +# ============================================================================= +# 任务结果缓存时间(秒),默认 30 分钟 +JOB_RESULT_TTL=1800 +# Webhook 最大重试次数 +WEBHOOK_MAX_RETRIES=3 +# Webhook 超时时间(秒) +WEBHOOK_TIMEOUT=10 +# 最大并发任务数 +MAX_CONCURRENT_JOBS=10 + +# ============================================================================= +# Worker 配置 +# ============================================================================= +# Worker 轮询间隔(秒) +WORKER_POLL_INTERVAL=1.0 +# 任务队列 Redis Key +JOB_QUEUE_KEY=job:queue +# 全局并发计数器 Redis Key +JOB_CONCURRENCY_KEY=job:concurrency +# 任务锁 TTL(秒) +JOB_LOCK_TTL=300 +# 任务最大重试次数 +JOB_MAX_RETRIES=3 +# 任务执行超时(秒) +JOB_EXECUTION_TIMEOUT=300 + +# ============================================================================= +# 外部服务配置(示例) +# ============================================================================= +# OSS 配置 # OSS_ENDPOINT=https://oss-cn-hangzhou.aliyuncs.com # OSS_ACCESS_KEY_ID=your_access_key # OSS_ACCESS_KEY_SECRET=your_secret_key # OSS_BUCKET_NAME=your_bucket -# Database (if needed) -# DATABASE_URL=mysql://user:password@localhost:5432/dbname +# 数据库配置 +# DATABASE_URL=mysql://user:password@localhost:3306/dbname