seaislee1209 fe6136555b
All checks were successful
Build and Deploy Backend / build-and-deploy (push) Successful in 2m33s
Build and Deploy Web / build-and-deploy (push) Successful in 1m26s
chore: JWT token 有效期从 24 小时改为 90 天
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 21:06:11 +08:00

40 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""应用配置"""
import os
from dotenv import load_dotenv
load_dotenv()
# 数据库:优先从 DB_HOST 等环境变量拼接 MySQL URL否则回退到 DATABASE_URL / SQLite
DB_HOST = os.getenv("DB_HOST", "")
if DB_HOST:
DB_USER = os.getenv("DB_USER", "airlabs_manage")
DB_PASSWORD = os.getenv("DB_PASSWORD", "")
DB_PORT = os.getenv("DB_PORT", "3306")
DB_NAME = os.getenv("DB_NAME", "airlabs_manage")
DATABASE_URL = f"mysql+pymysql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}?charset=utf8mb4"
else:
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./airlabs.db")
# JWT 认证
SECRET_KEY = os.getenv("SECRET_KEY", "airlabs-project-secret-key-change-in-production")
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 60 * 24 * 90 # 90 天
# CORS
CORS_ORIGINS = os.getenv("CORS_ORIGINS", "*").split(",")
# 成本计算
WORKING_DAYS_PER_MONTH = 22
# 豆包 AI火山引擎 ARK
ARK_API_KEY = os.getenv("ARK_API_KEY", "")
ARK_MODEL = os.getenv("ARK_MODEL", "doubao-seed-1-8-251228")
ARK_BASE_URL = os.getenv("ARK_BASE_URL", "https://ark.cn-beijing.volces.com/api/v3")
# 飞书自建应用
FEISHU_APP_ID = os.getenv("FEISHU_APP_ID", "")
FEISHU_APP_SECRET = os.getenv("FEISHU_APP_SECRET", "")
# 报告接收人手机号
REPORT_RECEIVERS = [p.strip() for p in os.getenv("REPORT_RECEIVERS", "").split(",") if p.strip()]