chore: fix config doc and use expect instead of return error message in `core`
This commit is contained in:
parent
60bbd5ea36
commit
7de60b0729
|
@ -3,17 +3,17 @@ use homedisk_server::serve_http;
|
||||||
use homedisk_types::config::Config;
|
use homedisk_types::config::Config;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() {
|
||||||
// init better_panic
|
// init better_panic
|
||||||
better_panic::install();
|
better_panic::install();
|
||||||
// init logger
|
// init logger
|
||||||
init_logger()?;
|
init_logger().expect("init logger");
|
||||||
|
|
||||||
// parse config
|
// parse config
|
||||||
let config = Config::parse()?;
|
let config = Config::parse().expect("parse config");
|
||||||
|
|
||||||
// open database connection
|
// open database connection
|
||||||
let db = Database::open("homedisk.db").await?;
|
let db = Database::open("homedisk.db").await.expect("open database file");
|
||||||
|
|
||||||
// change the type from Vec<String> to Vec<HeaderValue> so that the http server can correctly detect CORS hosts
|
// change the type from Vec<String> to Vec<HeaderValue> so that the http server can correctly detect CORS hosts
|
||||||
let origins = config
|
let origins = config
|
||||||
|
@ -31,9 +31,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
);
|
);
|
||||||
|
|
||||||
// start http server
|
// start http server
|
||||||
serve_http(host, origins, db, config).await?;
|
serve_http(host, origins, db, config).await.expect("start http server");
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Init logger
|
/// Init logger
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! # Configuration file
|
//! # Configuration file
|
||||||
//!
|
//!
|
||||||
//! Path to a config file is `config.toml` in the server root directory.
|
//! Path to a config file is `config.toml` in the system configuration directory (`~/.config/homedisk/config.toml`).
|
||||||
//!
|
//!
|
||||||
//! Example config:
|
//! Example config:
|
||||||
//!
|
//!
|
||||||
|
|
Loading…
Reference in New Issue