Files
2026-05-10 12:38:54 +08:00

145 lines
3.4 KiB
TOML

[default]
app.debug = false
app.description = "基于 FastAPI 的 chongming 打包脚手架"
app.name = "chongming"
app.version = "chongming"
env = "development"
prefix = "/api/v1"
upload_path = "uploads"
[database]
database_path = "./data/database.db"
type = "sqlite"
url = "sqlite+aiosqlite:///./data/database.db"
[database.sqlite]
connect_args.check_same_thread = false
connect_args.timeout = 15
echo = true
echo_pool = true
max_overflow = 10
pool_pre_ping = true
pool_recycle = 300
pool_size = 20
pool_timeout = 30
[scheduler]
job_store_path = "scheduler_jobs.db"
[cache]
cache_store_path = "./cache_data"
[security]
access_token_expire_minutes = 1440
algorithm = "HS256"
max_sessions_per_user = 5
refresh_token_expire_days = 7
secret_key = "your-secret-key-change-in-production"
# ============================================
# 订单号自动生成规则配置
# 每种订单类型可以独立配置生成规则
# 格式: {prefix}{date}{seq} 例如 PO202405080001
# prefix: 订单前缀
# date_format: 日期格式(Python strftime 格式)
# seq_width: 序号位数(自动补零)
# separator: 各部分之间的分隔符(可选)
# ============================================
[order_no]
# 采购订单: PO202405080001
purchase_order = { prefix = "PO", date_format = "%Y%m%d", seq_width = 4, separator = "" }
# 销售订单: SO202405080001
sales_order = { prefix = "SO", date_format = "%Y%m%d", seq_width = 4, separator = "" }
# 采购入库单: PI202405080001
purchase_inbound = { prefix = "PI", date_format = "%Y%m%d", seq_width = 4, separator = "" }
# 销售出库单: DO202405080001
sales_outbound = { prefix = "DO", date_format = "%Y%m%d", seq_width = 4, separator = "" }
[development]
debug = true
env = "development"
[development.server]
access_log = false
host = "0.0.0.0"
port = 8000
reload = true
[development.logging]
file = "logs"
format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
level = "DEBUG"
[development.cors]
allow_credentials = true
allow_headers = ["*"]
allow_methods = ["*"]
allow_origins = ["*"]
[production]
debug = false
env = "production"
[production.server]
access_log = false
host = "0.0.0.0"
port = 8000
reload = false
workers = 4
# 对于嵌入式设备(如 BM1684),建议启用环境变量覆盖:
# docker run -e APP_WORKERS=2 ...
# 可减少线程数,避免 "can't start new thread" 错误
[production.logging]
backup_count = 5 # 最多保存 10 个日志文件
file = "logs"
format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
level = "INFO"
max_size = 10485760 # 10MB
[production.cors]
allow_credentials = true
allow_headers = ["*"]
allow_methods = ["*"]
allow_origins = ["http://192.168.137.5:8000", "http://localhost:8000", "http://127.0.0.1:8000"]
[production.module_system]
path = [
["resources/app.mbank", "src/chongming/app", "app"],
["resources/plugins.mbank", "src/plugins", "plugins"],
]
type = "module-bank"
[production.file_system]
path = "static.svfs"
type = "svfs"
[pyinstaller_build_import]
base = [
"utils", # public 骨架
"utils.launch",
"utils.config",
"server",
"module_bank", # 模块化打包工具
"sqlite_vfs",
"sqlite_vfs.core",
"fastapi", # web 应用依赖
"fastapi.staticfiles",
"fastapi.middleware.cors",
"uvicorn",
"sqlmodel",
"aiosqlite",
"aiofiles",
"apscheduler",
"diskcache",
"bcrypt",
"python_multipart",
"jwt",
]
linux = [
"gunicorn.glogging",
"gunicorn.app",
"gunicorn.app.wsgiapp",
]
windows = []