refactor: 配置安全加固-从TOML移除密钥+去除死代码+统一端口

P0: 从config/production.toml和config/development.toml移除wechat_secret/jwt_secret
    这些密钥现在仅通过.env(EnvironmentFile)加载,不再进入Git历史
    config.rs: 新增直接环境变量名回退(JWT_SECRET而非仅APP_JWT_SECRET)
    
P1: - 移除config.rs中的server_ports字段(死代码,未被任何代码使用)
    - 简化main.rs端口fallback: 生产环境仅4433,开发环境仅8080/3000
    - .env.example版本号0.2.3→0.3.0
    
Docs: - AGENTS.md测试域名xmclassmate.top/dev→dev.xmclassmate.top
This commit is contained in:
moira
2026-05-13 15:17:45 +08:00
parent d879b65662
commit bded0113ee
6 changed files with 11 additions and 18 deletions

View File

@@ -7,5 +7,4 @@ ssl_cert_path = ""
rust_log = "debug"
environment = "development"
free_user_data_limit = 100
server_host = "0.0.0.0"
server_ports = [8080, 3000, 8000, 8888]
server_host = "0.0.0.0"

View File

@@ -1,11 +1,9 @@
database_url = "postgres://milkydata:44n6FdB8CdDAk5rk@127.0.0.1:5432/milkydata_dev"
wechat_appid = "wx5b00eb90621802f7"
wechat_secret = "494efc513faa310bfba588bda2849bfd"
jwt_secret = "dev-only-secret-change-in-production"
ssl_key_path = ""
ssl_cert_path = ""
rust_log = "debug"
environment = "development"
free_user_data_limit = 100
server_host = "0.0.0.0"
server_ports = [8080, 3000, 8000, 8888]
server_host = "0.0.0.0"

View File

@@ -1,11 +1,8 @@
database_url = "postgres://milkydata:44n6FdB8CdDAk5rk@154.37.213.24:5432/milkydata"
wechat_appid = "wx5b00eb90621802f7"
wechat_secret = "494efc513faa310bfba588bda2849bfd"
jwt_secret = "your_super_secret_key"
ssl_key_path = "/etc/ssl/private/private.key"
ssl_cert_path = "/etc/ssl/certs/full_chain.pem"
rust_log = "info"
environment = "production"
free_user_data_limit = 20
server_host = "0.0.0.0"
server_ports = [4433, 8443, 8080, 3000, 8000, 8888]
server_host = "0.0.0.0"