summaryrefslogtreecommitdiff
path: root/src/bin/obnam-server.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-09-28 09:10:45 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-03 10:34:56 +0300
commit864e20652458c1a4ae09c882ad3e29d6b0988b06 (patch)
tree2e08a43a4deb3759153105a8a3a4495faa3f9121 /src/bin/obnam-server.rs
parent164c5bfc707e21ebc1f1bf6bfb89e4adc2332ef0 (diff)
downloadobnam2-864e20652458c1a4ae09c882ad3e29d6b0988b06.tar.gz
feat: add rudimentary backup client
Also, a bit of logging for server.
Diffstat (limited to 'src/bin/obnam-server.rs')
-rw-r--r--src/bin/obnam-server.rs13
1 files changed, 10 insertions, 3 deletions
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))
}