aury-boot 0.0.5__py3-none-any.whl → 0.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aury/boot/_version.py +2 -2
- aury/boot/application/__init__.py +15 -0
- aury/boot/application/adapter/__init__.py +112 -0
- aury/boot/application/adapter/base.py +511 -0
- aury/boot/application/adapter/config.py +242 -0
- aury/boot/application/adapter/decorators.py +259 -0
- aury/boot/application/adapter/exceptions.py +202 -0
- aury/boot/application/adapter/http.py +325 -0
- aury/boot/application/app/middlewares.py +7 -4
- aury/boot/application/config/multi_instance.py +42 -26
- aury/boot/application/config/settings.py +111 -191
- aury/boot/application/middleware/logging.py +14 -1
- aury/boot/commands/generate.py +22 -22
- aury/boot/commands/init.py +41 -9
- aury/boot/commands/templates/project/AGENTS.md.tpl +8 -4
- aury/boot/commands/templates/project/aury_docs/01-model.md.tpl +17 -16
- aury/boot/commands/templates/project/aury_docs/11-logging.md.tpl +82 -43
- aury/boot/commands/templates/project/aury_docs/12-admin.md.tpl +14 -14
- aury/boot/commands/templates/project/aury_docs/13-channel.md.tpl +40 -28
- aury/boot/commands/templates/project/aury_docs/14-mq.md.tpl +9 -9
- aury/boot/commands/templates/project/aury_docs/15-events.md.tpl +8 -8
- aury/boot/commands/templates/project/aury_docs/16-adapter.md.tpl +403 -0
- aury/boot/commands/templates/project/aury_docs/99-cli.md.tpl +19 -19
- aury/boot/commands/templates/project/config.py.tpl +10 -10
- aury/boot/commands/templates/project/env_templates/_header.tpl +10 -0
- aury/boot/commands/templates/project/env_templates/admin.tpl +49 -0
- aury/boot/commands/templates/project/env_templates/cache.tpl +14 -0
- aury/boot/commands/templates/project/env_templates/database.tpl +22 -0
- aury/boot/commands/templates/project/env_templates/log.tpl +18 -0
- aury/boot/commands/templates/project/env_templates/messaging.tpl +46 -0
- aury/boot/commands/templates/project/env_templates/rpc.tpl +28 -0
- aury/boot/commands/templates/project/env_templates/scheduler.tpl +18 -0
- aury/boot/commands/templates/project/env_templates/service.tpl +18 -0
- aury/boot/commands/templates/project/env_templates/storage.tpl +38 -0
- aury/boot/commands/templates/project/env_templates/third_party.tpl +43 -0
- aury/boot/common/logging/__init__.py +26 -674
- aury/boot/common/logging/context.py +132 -0
- aury/boot/common/logging/decorators.py +118 -0
- aury/boot/common/logging/format.py +315 -0
- aury/boot/common/logging/setup.py +214 -0
- aury/boot/infrastructure/database/config.py +6 -14
- aury/boot/infrastructure/tasks/config.py +5 -13
- aury/boot/infrastructure/tasks/manager.py +8 -4
- aury/boot/testing/base.py +2 -2
- {aury_boot-0.0.5.dist-info → aury_boot-0.0.8.dist-info}/METADATA +2 -1
- {aury_boot-0.0.5.dist-info → aury_boot-0.0.8.dist-info}/RECORD +48 -27
- aury/boot/commands/templates/project/env.example.tpl +0 -281
- {aury_boot-0.0.5.dist-info → aury_boot-0.0.8.dist-info}/WHEEL +0 -0
- {aury_boot-0.0.5.dist-info → aury_boot-0.0.8.dist-info}/entry_points.txt +0 -0
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
# =============================================================================
|
|
2
|
-
# {project_name} 环境变量配置
|
|
3
|
-
# =============================================================================
|
|
4
|
-
# 复制此文件为 .env 并根据实际情况修改
|
|
5
|
-
# 所有配置项均有默认值,只需取消注释并修改需要覆盖的项
|
|
6
|
-
|
|
7
|
-
# =============================================================================
|
|
8
|
-
# 服务配置 (SERVICE_)
|
|
9
|
-
# =============================================================================
|
|
10
|
-
# 服务名称,用于日志目录区分
|
|
11
|
-
SERVICE_NAME={project_name_snake}
|
|
12
|
-
# 服务类型: api / worker
|
|
13
|
-
# SERVICE_TYPE=api
|
|
14
|
-
|
|
15
|
-
# =============================================================================
|
|
16
|
-
# 服务器配置 (SERVER_)
|
|
17
|
-
# =============================================================================
|
|
18
|
-
# SERVER_HOST=127.0.0.1
|
|
19
|
-
# SERVER_PORT=8000
|
|
20
|
-
# 工作进程数(生产环境建议设为 CPU 核心数)
|
|
21
|
-
# SERVER_WORKERS=1
|
|
22
|
-
# 是否启用热重载(生产环境应设为 false)
|
|
23
|
-
# SERVER_RELOAD=true
|
|
24
|
-
|
|
25
|
-
# =============================================================================
|
|
26
|
-
# 数据库配置 (DATABASE_)
|
|
27
|
-
# =============================================================================
|
|
28
|
-
# 支持多实例配置,格式: DATABASE_{{INSTANCE}}_{{FIELD}}
|
|
29
|
-
# 默认实例 (default):
|
|
30
|
-
# DATABASE_URL=sqlite+aiosqlite:///./dev.db
|
|
31
|
-
# DATABASE_DEFAULT_URL=sqlite+aiosqlite:///./dev.db
|
|
32
|
-
# PostgreSQL: postgresql+asyncpg://user:pass@localhost:5432/{project_name_snake}
|
|
33
|
-
# MySQL: mysql+aiomysql://user:pass@localhost:3306/{project_name_snake}
|
|
34
|
-
|
|
35
|
-
# 连接池大小
|
|
36
|
-
# DATABASE_POOL_SIZE=5
|
|
37
|
-
# 连接池最大溢出连接数
|
|
38
|
-
# DATABASE_MAX_OVERFLOW=10
|
|
39
|
-
# 连接回收时间(秒)
|
|
40
|
-
# DATABASE_POOL_RECYCLE=3600
|
|
41
|
-
# 获取连接超时时间(秒)
|
|
42
|
-
# DATABASE_POOL_TIMEOUT=30
|
|
43
|
-
# 是否在获取连接前 PING
|
|
44
|
-
# DATABASE_POOL_PRE_PING=true
|
|
45
|
-
# 是否输出 SQL 语句(调试用)
|
|
46
|
-
# DATABASE_ECHO=false
|
|
47
|
-
|
|
48
|
-
# 多实例示例 (readonly):
|
|
49
|
-
# DATABASE_READONLY_URL=postgresql+asyncpg://user:pass@replica:5432/{project_name_snake}
|
|
50
|
-
# DATABASE_READONLY_POOL_SIZE=10
|
|
51
|
-
|
|
52
|
-
# =============================================================================
|
|
53
|
-
# 缓存配置 (CACHE_)
|
|
54
|
-
# =============================================================================
|
|
55
|
-
# 支持多实例配置,格式: CACHE_{{INSTANCE}}_{{FIELD}}
|
|
56
|
-
# 缓存类型: memory / redis / memcached
|
|
57
|
-
# CACHE_TYPE=memory
|
|
58
|
-
# CACHE_URL=redis://localhost:6379/0
|
|
59
|
-
# 内存缓存最大大小
|
|
60
|
-
# CACHE_MAX_SIZE=1000
|
|
61
|
-
# 默认 TTL(秒)
|
|
62
|
-
# CACHE_DEFAULT_TTL=300
|
|
63
|
-
#
|
|
64
|
-
# 多实例示例 (session):
|
|
65
|
-
# CACHE_SESSION_TYPE=redis
|
|
66
|
-
# CACHE_SESSION_URL=redis://localhost:6379/2
|
|
67
|
-
|
|
68
|
-
# =============================================================================
|
|
69
|
-
# 日志配置 (LOG_)
|
|
70
|
-
# =============================================================================
|
|
71
|
-
# 日志级别: DEBUG / INFO / WARNING / ERROR / CRITICAL
|
|
72
|
-
# LOG_LEVEL=INFO
|
|
73
|
-
# 日志文件目录
|
|
74
|
-
# LOG_DIR=logs
|
|
75
|
-
# 日志文件轮转时间 (HH:MM 格式)
|
|
76
|
-
# LOG_ROTATION_TIME=00:00
|
|
77
|
-
# 日志文件轮转大小阈值
|
|
78
|
-
# LOG_ROTATION_SIZE=100 MB
|
|
79
|
-
# 日志文件保留天数
|
|
80
|
-
# LOG_RETENTION_DAYS=7
|
|
81
|
-
# 是否启用日志文件轮转
|
|
82
|
-
# LOG_ENABLE_FILE_ROTATION=true
|
|
83
|
-
# 是否输出日志到控制台
|
|
84
|
-
# LOG_ENABLE_CONSOLE=true
|
|
85
|
-
|
|
86
|
-
# =============================================================================
|
|
87
|
-
# 健康检查配置 (HEALTH_CHECK_)
|
|
88
|
-
# =============================================================================
|
|
89
|
-
# 健康检查端点路径
|
|
90
|
-
# HEALTH_CHECK_PATH=/api/health
|
|
91
|
-
# 是否启用健康检查端点
|
|
92
|
-
# HEALTH_CHECK_ENABLED=true
|
|
93
|
-
|
|
94
|
-
# =============================================================================
|
|
95
|
-
# 管理后台配置 (ADMIN_) - SQLAdmin Admin Console
|
|
96
|
-
# =============================================================================
|
|
97
|
-
# 是否启用管理后台(生产建议仅内网或配合反向代理)
|
|
98
|
-
# ADMIN_ENABLED=false
|
|
99
|
-
# 管理后台路径(默认 /api/admin-console,避免与业务 URL 冲突)
|
|
100
|
-
# ADMIN_PATH=/api/admin-console
|
|
101
|
-
#
|
|
102
|
-
# SQLAdmin 通常要求同步 SQLAlchemy Engine:
|
|
103
|
-
# - 若 DATABASE_URL 使用的是异步驱动(如 postgresql+asyncpg),建议显式提供同步 URL 覆盖
|
|
104
|
-
# ADMIN_DATABASE_URL=postgresql+psycopg://user:pass@localhost:5432/{project_name_snake}
|
|
105
|
-
#
|
|
106
|
-
# 可选:显式指定项目侧模块(用于注册 views/auth)
|
|
107
|
-
# ADMIN_VIEWS_MODULE={project_name_snake}.admin_console
|
|
108
|
-
#
|
|
109
|
-
# 认证(默认建议 basic / bearer;jwt/custom 通常需要自定义 backend)
|
|
110
|
-
# ADMIN_AUTH_MODE=basic
|
|
111
|
-
# ADMIN_AUTH_SECRET_KEY=CHANGE_ME_TO_A_RANDOM_SECRET
|
|
112
|
-
#
|
|
113
|
-
# basic:登录页用户名/密码
|
|
114
|
-
# ADMIN_AUTH_BASIC_USERNAME=admin
|
|
115
|
-
# ADMIN_AUTH_BASIC_PASSWORD=change_me
|
|
116
|
-
#
|
|
117
|
-
# bearer:token 白名单(也支持在登录页输入 token)
|
|
118
|
-
# ADMIN_AUTH_BEARER_TOKENS=["change_me_token"]
|
|
119
|
-
#
|
|
120
|
-
# custom/jwt:自定义认证后端(动态导入)
|
|
121
|
-
# ADMIN_AUTH_BACKEND=yourpkg.admin_auth:backend
|
|
122
|
-
|
|
123
|
-
# =============================================================================
|
|
124
|
-
# CORS 配置 (CORS_)
|
|
125
|
-
# =============================================================================
|
|
126
|
-
# 允许的 CORS 源(生产环境应设置具体域名)
|
|
127
|
-
# CORS_ORIGINS=["*"]
|
|
128
|
-
# 是否允许 CORS 凭据
|
|
129
|
-
# CORS_ALLOW_CREDENTIALS=true
|
|
130
|
-
# 允许的 CORS 方法
|
|
131
|
-
# CORS_ALLOW_METHODS=["*"]
|
|
132
|
-
# 允许的 CORS 头
|
|
133
|
-
# CORS_ALLOW_HEADERS=["*"]
|
|
134
|
-
|
|
135
|
-
# =============================================================================
|
|
136
|
-
# 调度器配置 (SCHEDULER_)
|
|
137
|
-
# =============================================================================
|
|
138
|
-
# 是否在 API 服务中启用内嵌调度器
|
|
139
|
-
# SCHEDULER_ENABLED=true
|
|
140
|
-
# 定时任务模块列表(为空时自动发现 schedules 模块)
|
|
141
|
-
# SCHEDULER_SCHEDULE_MODULES=[]
|
|
142
|
-
|
|
143
|
-
# =============================================================================
|
|
144
|
-
# 任务队列配置 (TASK_)
|
|
145
|
-
# =============================================================================
|
|
146
|
-
# 任务队列代理 URL(如 Redis 或 RabbitMQ)
|
|
147
|
-
# TASK_BROKER_URL=redis://localhost:6379/1
|
|
148
|
-
# 最大重试次数
|
|
149
|
-
# TASK_MAX_RETRIES=3
|
|
150
|
-
# 任务超时时间(秒)
|
|
151
|
-
# TASK_TIMEOUT=3600
|
|
152
|
-
|
|
153
|
-
# =============================================================================
|
|
154
|
-
# 流式通道配置 (CHANNEL_) - SSE/实时通信
|
|
155
|
-
# =============================================================================
|
|
156
|
-
# 支持多实例配置,格式: CHANNEL_{{INSTANCE}}_{{FIELD}}
|
|
157
|
-
# 后端类型: memory / redis
|
|
158
|
-
# CHANNEL_BACKEND=memory
|
|
159
|
-
# CHANNEL_DEFAULT_BACKEND=memory
|
|
160
|
-
#
|
|
161
|
-
# Redis 后端配置:
|
|
162
|
-
# CHANNEL_DEFAULT_BACKEND=redis
|
|
163
|
-
# CHANNEL_DEFAULT_URL=redis://localhost:6379/3
|
|
164
|
-
# CHANNEL_DEFAULT_KEY_PREFIX=channel:
|
|
165
|
-
# CHANNEL_DEFAULT_TTL=86400
|
|
166
|
-
#
|
|
167
|
-
# 多实例示例 (notifications):
|
|
168
|
-
# CHANNEL_NOTIFICATIONS_BACKEND=redis
|
|
169
|
-
# CHANNEL_NOTIFICATIONS_URL=redis://localhost:6379/3
|
|
170
|
-
|
|
171
|
-
# =============================================================================
|
|
172
|
-
# 消息队列配置 (MQ_)
|
|
173
|
-
# =============================================================================
|
|
174
|
-
# 支持多实例配置,格式: MQ_{{INSTANCE}}_{{FIELD}}
|
|
175
|
-
# 后端类型: redis / rabbitmq
|
|
176
|
-
# MQ_BACKEND=redis
|
|
177
|
-
# MQ_DEFAULT_BACKEND=redis
|
|
178
|
-
#
|
|
179
|
-
# Redis 后端配置:
|
|
180
|
-
# MQ_DEFAULT_URL=redis://localhost:6379/4
|
|
181
|
-
# MQ_DEFAULT_MAX_CONNECTIONS=10
|
|
182
|
-
#
|
|
183
|
-
# RabbitMQ 后端配置:
|
|
184
|
-
# MQ_DEFAULT_BACKEND=rabbitmq
|
|
185
|
-
# MQ_DEFAULT_URL=amqp://guest:guest@localhost:5672/
|
|
186
|
-
# MQ_DEFAULT_PREFETCH_COUNT=10
|
|
187
|
-
# MQ_DEFAULT_HEARTBEAT=60
|
|
188
|
-
#
|
|
189
|
-
# 多实例示例 (orders):
|
|
190
|
-
# MQ_ORDERS_BACKEND=rabbitmq
|
|
191
|
-
# MQ_ORDERS_URL=amqp://guest:guest@localhost:5672/orders
|
|
192
|
-
|
|
193
|
-
# =============================================================================
|
|
194
|
-
# 事件总线配置 (EVENT_)
|
|
195
|
-
# =============================================================================
|
|
196
|
-
# 支持多实例配置,格式: EVENT_{{INSTANCE}}_{{FIELD}}
|
|
197
|
-
# 后端类型: memory / redis / rabbitmq
|
|
198
|
-
# EVENT_BACKEND=memory
|
|
199
|
-
# EVENT_DEFAULT_BACKEND=memory
|
|
200
|
-
#
|
|
201
|
-
# Redis Pub/Sub 后端:
|
|
202
|
-
# EVENT_DEFAULT_BACKEND=redis
|
|
203
|
-
# EVENT_DEFAULT_URL=redis://localhost:6379/5
|
|
204
|
-
# EVENT_DEFAULT_KEY_PREFIX=events:
|
|
205
|
-
#
|
|
206
|
-
# RabbitMQ 后端:
|
|
207
|
-
# EVENT_DEFAULT_BACKEND=rabbitmq
|
|
208
|
-
# EVENT_DEFAULT_URL=amqp://guest:guest@localhost:5672/
|
|
209
|
-
# EVENT_EXCHANGE_NAME=aury.events
|
|
210
|
-
# EVENT_DEFAULT_EXCHANGE_TYPE=topic
|
|
211
|
-
#
|
|
212
|
-
# 多实例示例 (domain):
|
|
213
|
-
# EVENT_DOMAIN_BACKEND=rabbitmq
|
|
214
|
-
# EVENT_DOMAIN_URL=amqp://guest:guest@localhost:5672/
|
|
215
|
-
# EVENT_DOMAIN_EXCHANGE_NAME=domain.events
|
|
216
|
-
|
|
217
|
-
# =============================================================================
|
|
218
|
-
# 数据库迁移配置 (MIGRATION_)
|
|
219
|
-
# =============================================================================
|
|
220
|
-
# Alembic 配置文件路径
|
|
221
|
-
# MIGRATION_CONFIG_PATH=alembic.ini
|
|
222
|
-
# Alembic 迁移脚本目录
|
|
223
|
-
# MIGRATION_SCRIPT_LOCATION=migrations
|
|
224
|
-
# 是否自动创建迁移配置和目录
|
|
225
|
-
# MIGRATION_AUTO_CREATE=true
|
|
226
|
-
|
|
227
|
-
# =============================================================================
|
|
228
|
-
# 对象存储配置 (STORAGE_) - 基于 aury-sdk-storage
|
|
229
|
-
# =============================================================================
|
|
230
|
-
# 是否启用存储组件
|
|
231
|
-
# STORAGE_ENABLED=true
|
|
232
|
-
# 存储类型: local / s3 / cos / oss
|
|
233
|
-
# STORAGE_TYPE=local
|
|
234
|
-
#
|
|
235
|
-
# 本地存储(开发环境)
|
|
236
|
-
# STORAGE_BASE_PATH=./storage
|
|
237
|
-
#
|
|
238
|
-
# S3/COS/OSS 通用配置
|
|
239
|
-
# STORAGE_ACCESS_KEY_ID=AKIDxxxxx
|
|
240
|
-
# STORAGE_ACCESS_KEY_SECRET=xxxxx
|
|
241
|
-
# STORAGE_SESSION_TOKEN=
|
|
242
|
-
# STORAGE_ENDPOINT=https://cos.ap-guangzhou.myqcloud.com
|
|
243
|
-
# STORAGE_REGION=ap-guangzhou
|
|
244
|
-
# STORAGE_BUCKET_NAME=my-bucket-1250000000
|
|
245
|
-
# STORAGE_ADDRESSING_STYLE=virtual
|
|
246
|
-
#
|
|
247
|
-
# STS AssumeRole(可选,服务端自动刷新凭证)
|
|
248
|
-
# STORAGE_ROLE_ARN=
|
|
249
|
-
# STORAGE_ROLE_SESSION_NAME=aury-storage
|
|
250
|
-
# STORAGE_EXTERNAL_ID=
|
|
251
|
-
# STORAGE_STS_ENDPOINT=
|
|
252
|
-
# STORAGE_STS_REGION=
|
|
253
|
-
# STORAGE_STS_DURATION_SECONDS=3600
|
|
254
|
-
|
|
255
|
-
# =============================================================================
|
|
256
|
-
# RPC 客户端配置 (RPC_CLIENT_)
|
|
257
|
-
# =============================================================================
|
|
258
|
-
# 服务地址映射 {{service_name: url}}
|
|
259
|
-
# RPC_CLIENT_SERVICES={{"user-service": "http://localhost:8001"}}
|
|
260
|
-
# 默认超时时间(秒)
|
|
261
|
-
# RPC_CLIENT_DEFAULT_TIMEOUT=30
|
|
262
|
-
# 默认重试次数
|
|
263
|
-
# RPC_CLIENT_DEFAULT_RETRY_TIMES=3
|
|
264
|
-
# DNS 解析使用的协议
|
|
265
|
-
# RPC_CLIENT_DNS_SCHEME=http
|
|
266
|
-
# DNS 解析默认端口
|
|
267
|
-
# RPC_CLIENT_DNS_PORT=80
|
|
268
|
-
# 是否使用 DNS 回退(K8s/Docker Compose 自动 DNS)
|
|
269
|
-
# RPC_CLIENT_USE_DNS_FALLBACK=true
|
|
270
|
-
|
|
271
|
-
# =============================================================================
|
|
272
|
-
# RPC 服务注册配置 (RPC_SERVICE_)
|
|
273
|
-
# =============================================================================
|
|
274
|
-
# 服务名称(用于注册)
|
|
275
|
-
# RPC_SERVICE_NAME={project_name_snake}
|
|
276
|
-
# 服务地址(用于注册)
|
|
277
|
-
# RPC_SERVICE_URL=http://localhost:8000
|
|
278
|
-
# 健康检查 URL(用于注册)
|
|
279
|
-
# RPC_SERVICE_HEALTH_CHECK_URL=http://localhost:8000/api/health
|
|
280
|
-
# 是否自动注册到服务注册中心
|
|
281
|
-
# RPC_SERVICE_AUTO_REGISTER=false
|
|
File without changes
|
|
File without changes
|