Initial GuruConnect implementation - Phase 1 MVP
- Agent: DXGI/GDI screen capture, mouse/keyboard input, WebSocket transport - Server: Axum relay, session management, REST API - Dashboard: React viewer components with TypeScript - Protocol: Protobuf definitions for all message types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
45
server/src/config.rs
Normal file
45
server/src/config.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
//! Server configuration
|
||||
|
||||
use anyhow::Result;
|
||||
use serde::Deserialize;
|
||||
use std::env;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Config {
|
||||
/// Address to listen on (e.g., "0.0.0.0:8080")
|
||||
pub listen_addr: String,
|
||||
|
||||
/// Database URL (optional for MVP)
|
||||
pub database_url: Option<String>,
|
||||
|
||||
/// JWT secret for authentication
|
||||
pub jwt_secret: Option<String>,
|
||||
|
||||
/// Enable debug logging
|
||||
pub debug: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Load configuration from environment variables
|
||||
pub fn load() -> Result<Self> {
|
||||
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(),
|
||||
jwt_secret: env::var("JWT_SECRET").ok(),
|
||||
debug: env::var("DEBUG")
|
||||
.map(|v| v == "1" || v.to_lowercase() == "true")
|
||||
.unwrap_or(false),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
listen_addr: "0.0.0.0:8080".to_string(),
|
||||
database_url: None,
|
||||
jwt_secret: None,
|
||||
debug: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user