29 lines
682 B
Python
29 lines
682 B
Python
"""
|
|
应用配置模块
|
|
"""
|
|
from pydantic_settings import BaseSettings
|
|
from typing import List
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""应用配置"""
|
|
|
|
# 工作空间基础路径
|
|
BASE_WORKSPACE: str = "/Users/mac/test/workspace"
|
|
|
|
# 可通过环境变量覆盖:export BASE_WORKSPACE=/custom/path
|
|
|
|
# CORS 配置
|
|
CORS_ORIGINS: List[str] = ["*"]
|
|
# CORS_ORIGINS: List[str] = ["http://localhost:5173", "http://127.0.0.1:5173"]
|
|
|
|
# 项目名验证正则:仅允许中英文、数字、下划线、横杠
|
|
PROJECT_NAME_PATTERN: str = r"^[\w一-龥\-]+$"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
|
|
|
|
settings = Settings()
|