You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import os
from datetime import timedelta
class Config:
"""应用配置类"""
# 数据库配置
MYSQL_HOST = '127.0.0.1'
MYSQL_PORT = 3306
MYSQL_USER = 'root'
MYSQL_PASSWORD = 'sxd123'
MYSQL_DATABASE = 'Simple_CA'
# SQLAlchemy配置
SQLALCHEMY_DATABASE_URI = f'mysql+pymysql://{MYSQL_USER}:{MYSQL_PASSWORD}@{MYSQL_HOST}:{MYSQL_PORT}/{MYSQL_DATABASE}?charset=utf8mb4'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = True # 开发环境启用SQL日志方便调试
# JWT配置
SECRET_KEY = os.environ.get('SECRET_KEY') or 'your-secret-key-change-in-production'
JWT_EXPIRATION_DELTA = timedelta(days=7) # Token有效期7天
# 文件上传配置
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB
UPLOAD_FOLDER = 'uploads'
CERTIFICATE_FOLDER = 'certificates'
# CA根证书配置
CA_PRIVATE_KEY_PATH = 'ca/ca_private_key.pem'
CA_CERTIFICATE_PATH = 'ca/ca_certificate.pem'
CA_KEY_SIZE = 2048
CERT_VALIDITY_DAYS = 365 # 证书有效期1年