From d75d6cd1a64740b196ea2e468850dcde93043bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=3F=2E=2E=E6=BF=A1=2E=2E?= <2324281453@qq.com> Date: Thu, 2 Jan 2025 22:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0env.example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 53 +++++++++++++++++++++++++++++++++++++++++++++ mooc/core/config.py | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..be52513 --- /dev/null +++ b/.env.example @@ -0,0 +1,53 @@ +#-------------------- +# 基础配置 +# 请复制此文件并重命名为.env,然后根据实际情况修改配置 +#-------------------- +# 项目名称 +PROJECT_NAME=ExamService +# API版本号 +VERSION=1.0.0 +# API前缀路径 +API_V1_STR=/api/v1 + +#-------------------- +# 数据库配置 +#-------------------- +# MySQL数据库用户名 +MYSQL_USER=your_username +# MySQL数据库密码 +MYSQL_PASSWORD=your_secure_password +# MySQL数据库主机地址 (默认: localhost) +MYSQL_HOST=localhost +# MySQL数据库端口 (默认: 3306) +MYSQL_PORT=3306 +# MySQL数据库名称 +MYSQL_DATABASE=your_database_name + +# 是否启用SQL语句打印 (True/False) +SQLALCHEMY_ECHO=True + +#-------------------- +# 安全配置 +#-------------------- +# JWT密钥 (重要: 生产环境必须修改为强密钥) +SECRET_KEY=please_change_this_to_complex_random_secret +# JWT加密算法 (可选: HS256, HS384, HS512) +ALGORITHM=HS256 +# 访问令牌过期时间(分钟) +ACCESS_TOKEN_EXPIRE_MINUTES=30 + +#-------------------- +# 微信配置 +#-------------------- +# 微信小程序 AppID (从微信开发者平台获取) +WECHAT_APPID=your_appid_here +# 微信小程序 AppSecret (从微信开发者平台获取,请妥善保管) +WECHAT_APPSECRET=your_appsecret_here + +#-------------------- +# 安全提示 +#-------------------- +# 1. 生产环境中请使用强密码和密钥 +# 2. 不要将包含敏感信息的.env文件提交到版本控制系统 +# 3. 建议定期更新密钥和密码 +# 4. 确保文件权限设置正确,只允许必要的用户访问 \ No newline at end of file diff --git a/mooc/core/config.py b/mooc/core/config.py index decd6ab..98a2666 100644 --- a/mooc/core/config.py +++ b/mooc/core/config.py @@ -16,7 +16,7 @@ class Settings(BaseSettings): SQLALCHEMY_DATABASE_URI: Optional[str] = None SQLALCHEMY_ECHO: bool = True - SECRET_KEY: str = "your-secret-key-here" # ����ʹ�ø��ӵ�����ַ��� + SECRET_KEY: str = "your-secret-key-here" ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 30