[Unit]
Description=Rust Backend Production Service
After=network.target postgresql.service
Wants=network.target

[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/root/rust/rust_backend
ExecStart=/root/rust/rust_backend/rust-backend
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal

# ⚠️ 部署前填写实际值
Environment=DATABASE_URL=postgres://user:pass@host:5432/dbname
Environment=WECHAT_APPID=your_wechat_appid
Environment=WECHAT_SECRET=your_wechat_secret
Environment=JWT_SECRET=your_jwt_secret
Environment=SSL_KEY_PATH=/etc/ssl/private/private.key
Environment=SSL_CERT_PATH=/etc/ssl/certs/full_chain.pem
Environment=RUST_LOG=info
Environment=APP_VERSION=0.3.0
Environment=FREE_USER_DATA_LIMIT=20
Environment=APP_BASE_URL=https://xmclassmate.top
Environment=ALIPAY_APP_ID=your_alipay_app_id
Environment=ALIPAY_GATEWAY=https://openapi.alipay.com/gateway.do
Environment=ALIPAY_ALIPAY_PUBLIC_KEY=your_alipay_public_key
Environment=ALIPAY_PRIVATE_KEY=your_private_key_base64

NoNewPrivileges=yes
PrivateTmp=yes
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/root/rust/rust_backend

SyslogIdentifier=rust-backend

[Install]
WantedBy=multi-user.target
