Have build script create .env if not found

This commit is contained in:
Edward Shen 2021-07-09 20:43:33 -04:00
parent 60bec5592a
commit c98a6d59f4
Signed by: edward
GPG key ID: 19182661E818369F

View file

@ -34,7 +34,10 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut path = PathBuf::from_str(&project_root)?; let mut path = PathBuf::from_str(&project_root)?;
path.push(".env"); path.push(".env");
let mut file = std::fs::OpenOptions::new().append(true).open(path)?; let mut file = std::fs::OpenOptions::new()
.append(true)
.create(true)
.open(path)?;
file.write_all(b"\nDATABASE_URL=sqlite:./cache/metadata.sqlite\n")?; file.write_all(b"\nDATABASE_URL=sqlite:./cache/metadata.sqlite\n")?;
file.sync_all()?; file.sync_all()?;
} }