make a data.db
This commit is contained in:
		
							parent
							
								
									a94eb03a40
								
							
						
					
					
						commit
						0b4df276c6
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -58,14 +58,17 @@ async fn main() -> std::io::Result<()> {
 | 
				
			||||||
    let site;
 | 
					    let site;
 | 
				
			||||||
    let temp;
 | 
					    let temp;
 | 
				
			||||||
    let logs;
 | 
					    let logs;
 | 
				
			||||||
 | 
					    let db;
 | 
				
			||||||
    if Cli::parse().dev {
 | 
					    if Cli::parse().dev {
 | 
				
			||||||
        site = "./public";
 | 
					        site = "./public";
 | 
				
			||||||
        logs = "/tmp/tfcsite";
 | 
					        logs = "/tmp/tfcsite";
 | 
				
			||||||
        temp = "/tmp/tfcsite";
 | 
					        temp = "/tmp/tfcsite";
 | 
				
			||||||
 | 
					        db = "sqlite://./data.db";
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        site = "../public";
 | 
					        site = "../public";
 | 
				
			||||||
        logs = "/storage/logs/tfcsite";
 | 
					        logs = "/storage/logs/tfcsite";
 | 
				
			||||||
        temp = "/tmp/tfcsite";
 | 
					        temp = "/tmp/tfcsite";
 | 
				
			||||||
 | 
					        db = "sqlite:///storage/data.db";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::fs::create_dir_all(&logs)?;
 | 
					    std::fs::create_dir_all(&logs)?;
 | 
				
			||||||
| 
						 | 
					@ -107,7 +110,7 @@ async fn main() -> std::io::Result<()> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    info!("starting HTTP server at http://localhost:4242");
 | 
					    info!("starting HTTP server at http://localhost:4242");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let conn = SqliteConnection::connect("sqlite://./data.db")
 | 
					    let conn = SqliteConnection::connect(db)
 | 
				
			||||||
        .await
 | 
					        .await
 | 
				
			||||||
        .expect("Couldn't connect sqlite db");
 | 
					        .expect("Couldn't connect sqlite db");
 | 
				
			||||||
    let data = web::Data::new(conn);
 | 
					    let data = web::Data::new(conn);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue