From 864e20652458c1a4ae09c882ad3e29d6b0988b06 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 28 Sep 2020 09:10:45 +0300 Subject: feat: add rudimentary backup client Also, a bit of logging for server. --- src/bin/obnam-server.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/bin/obnam-server.rs') diff --git a/src/bin/obnam-server.rs b/src/bin/obnam-server.rs index 8ad792e..5723b23 100644 --- a/src/bin/obnam-server.rs +++ b/src/bin/obnam-server.rs @@ -1,4 +1,5 @@ use bytes::Bytes; +use log::{debug, error, info}; use obnam::{chunk::Chunk, chunkid::ChunkId, chunkmeta::ChunkMeta, index::Index, store::Store}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -19,6 +20,8 @@ struct Opt { #[tokio::main] async fn main() -> anyhow::Result<()> { + pretty_env_logger::init(); + let opt = Opt::from_args(); let config = Config::read_config(&opt.config).unwrap(); let config_bare = config.clone(); @@ -28,6 +31,9 @@ async fn main() -> anyhow::Result<()> { let index = Arc::new(Mutex::new(Index::default())); let index = warp::any().map(move || Arc::clone(&index)); + info!("Obnam server starting up"); + debug!("Configuration: {:?}", config_bare); + let create = warp::post() .and(warp::path("chunks")) .and(config.clone()) @@ -58,9 +64,9 @@ async fn main() -> anyhow::Result<()> { let webroot = create.or(fetch).or(search).or(delete); warp::serve(webroot) - .tls() - .key_path(config_bare.tls_key) - .cert_path(config_bare.tls_cert) + // .tls() + // .key_path(config_bare.tls_key) + // .cert_path(config_bare.tls_cert) .run(([127, 0, 0, 1], config_bare.port)) .await; Ok(()) @@ -148,6 +154,7 @@ pub async fn create_chunk( index.insert_generation(id.clone()); } + info!("created chunk {}: {:?}", id, meta); Ok(ChunkResult::Created(id)) } -- cgit v1.2.1