A very performant and light (2mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres/SQLite.

Fix path for db and admin-setup-token

Changed files
+10 -4
src
+10 -4
src/lib.rs
··· 37 _ => { 38 info!("No PostgreSQL connection string found, using SQLite"); 39 40 // Create a data directory if it doesn't exist 41 - let data_dir = std::path::Path::new("data"); 42 if !data_dir.exists() { 43 - std::fs::create_dir_all(data_dir)?; 44 } 45 46 let db_path = data_dir.join("simplelink.db"); ··· 102 }; 103 104 if user_count == 0 { 105 - // Generate a random token using simple characters 106 let token: String = (0..32) 107 .map(|_| { 108 let idx = rand::thread_rng().gen_range(0..62); ··· 114 }) 115 .collect(); 116 117 // Save token to file 118 - let mut file = File::create("admin-setup-token.txt")?; 119 writeln!(file, "{}", token)?; 120 121 info!("No users found - generated admin setup token");
··· 37 _ => { 38 info!("No PostgreSQL connection string found, using SQLite"); 39 40 + // Get the project root directory 41 + let project_root = std::env::current_dir()?; 42 + let data_dir = project_root.join("data"); 43 + 44 // Create a data directory if it doesn't exist 45 if !data_dir.exists() { 46 + std::fs::create_dir_all(&data_dir)?; 47 } 48 49 let db_path = data_dir.join("simplelink.db"); ··· 105 }; 106 107 if user_count == 0 { 108 let token: String = (0..32) 109 .map(|_| { 110 let idx = rand::thread_rng().gen_range(0..62); ··· 116 }) 117 .collect(); 118 119 + // Get the project root directory 120 + let project_root = std::env::current_dir()?; 121 + let token_path = project_root.join("admin-setup-token.txt"); 122 + 123 // Save token to file 124 + let mut file = File::create(token_path)?; 125 writeln!(file, "{}", token)?; 126 127 info!("No users found - generated admin setup token");