modify: config sqlite 配置规范

This commit is contained in:
2026-01-31 19:26:28 +08:00
parent ee899b2eb3
commit f7dbe571cc
5 changed files with 2158 additions and 147 deletions
@@ -1,22 +1,30 @@
[default]
app.name = "{{ cookiecutter.project_name }}"
app.version = "{{ cookiecutter.author_name }}"
app.version = "{{ cookiecutter.project_name }}"
app.description = "基于 FastAPI 和 Tortoise-ORM 的 chongming 打包脚手架"
app.debug = false
env = "production"
[server]
host = "0.0.0.0"
port = 8000
reload = false
workers = 4
[database]
url = "sqlite://db.sqlite3"
# PostgreSQL 示例: "postgres://user:pass@localhost:5432/dbname"
# MySQL 示例: "mysql://user:pass@localhost:3306/dbname"
type = "sqlite"
generate_schemas = true # 生产环境使用迁移工具
[database.sqlite]
engine = "tortoise.backends.sqlite"
file_path = "db.sqlite3"
journal_mode = "WAL"
busy_timeout = 10000
maxsize = 10
minsize = 1
cache_size = -2000
synchronous = "NORMAL"
temp_store = "MEMORY"
mmap_size = 1073741824
foreign_keys = true
auto_vacuum = "INCREMENTAL"
max_cached_statements = 100
readonly = false
[security]
secret_key = "your-secret-key-change-in-production"
algorithm = "HS256"
@@ -32,10 +40,6 @@ port = 8000
reload = true
# workers = 4
[development.database]
url = "sqlite://dev.db"
generate_schemas = true
[development.logging]
level = "DEBUG"
file = "logs/dev.log"
@@ -56,16 +60,12 @@ port = 8000
reload = false
workers = 1
[production.database]
url = "sqlite://prod.db"
generate_schemas = true
[production.logging]
level = "INFO"
file = "logs/prod.log"
[production.cors]
allow_origins = ["https://yourdomain.com"]
allow_origins = ["https://yourdomain.com", "http://localhos:8000", "http://127.0.0.1:8000"]
allow_credentials = true
allow_methods = ["GET", "POST", "PUT", "DELETE"]
allow_headers = ["Authorization", "Content-Type"]
@@ -78,9 +78,5 @@ path = ["resources/app.mbank", "resources/plugins.mbank"]
type = "svfs"
path = "resources/application.vfs"
[redis]
enabled = false
url = "redis://localhost:6379"
[cache]
default_ttl = 300
default_ttl = 300