make cosmetic changes to state schema, add fileset passwords for forthcoming functionality

This commit is contained in:
xenofem 2022-08-16 06:16:00 -04:00
parent 073feda920
commit aef58d133b
9 changed files with 327 additions and 119 deletions

View file

@ -1,7 +1,6 @@
mod download;
mod state;
mod store;
mod timestamp;
mod upload;
mod zip;
@ -310,7 +309,9 @@ async fn main() -> std::io::Result<()> {
let cachebuster: String = env_or_else("TRANSBEAM_CACHEBUSTER", String::new);
let state_file: PathBuf = match std::env::var("TRANSBEAM_STATE_FILE") {
Ok(v) => v.parse().unwrap_or_else(|_| panic!("Invalid value {} for variable TRANSBEAM_STATE_FILE", v)),
Ok(v) => v
.parse()
.unwrap_or_else(|_| panic!("Invalid value {} for variable TRANSBEAM_STATE_FILE", v)),
Err(_) => {
let legacy_state_file = storage_dir.join("files.json");
if legacy_state_file.is_file() {
@ -322,7 +323,9 @@ async fn main() -> std::io::Result<()> {
};
let data = web::Data::new(AppData {
state: StateDb::load(state_file).await.expect("Failed to load state file"),
state: StateDb::load(state_file)
.await
.expect("Failed to load state file"),
config: Config {
base_url,
max_upload_size,