Add PostgreSQL database persistence
- Add connect_machines, connect_sessions, connect_session_events, connect_support_codes tables - Implement db module with connection pooling (sqlx) - Add machine persistence across server restarts - Add audit logging for session/viewer events - Support codes now persisted to database 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,9 +9,12 @@ pub struct Config {
|
||||
/// Address to listen on (e.g., "0.0.0.0:8080")
|
||||
pub listen_addr: String,
|
||||
|
||||
/// Database URL (optional for MVP)
|
||||
/// Database URL (optional - server works without it)
|
||||
pub database_url: Option<String>,
|
||||
|
||||
/// Maximum database connections in pool
|
||||
pub database_max_connections: u32,
|
||||
|
||||
/// JWT secret for authentication
|
||||
pub jwt_secret: Option<String>,
|
||||
|
||||
@@ -25,6 +28,10 @@ impl Config {
|
||||
Ok(Self {
|
||||
listen_addr: env::var("LISTEN_ADDR").unwrap_or_else(|_| "0.0.0.0:8080".to_string()),
|
||||
database_url: env::var("DATABASE_URL").ok(),
|
||||
database_max_connections: env::var("DATABASE_MAX_CONNECTIONS")
|
||||
.ok()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(5),
|
||||
jwt_secret: env::var("JWT_SECRET").ok(),
|
||||
debug: env::var("DEBUG")
|
||||
.map(|v| v == "1" || v.to_lowercase() == "true")
|
||||
@@ -38,6 +45,7 @@ impl Default for Config {
|
||||
Self {
|
||||
listen_addr: "0.0.0.0:8080".to_string(),
|
||||
database_url: None,
|
||||
database_max_connections: 5,
|
||||
jwt_secret: None,
|
||||
debug: false,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user