-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(httpd): fix clippy warnings and return error if exists
Signed-off-by: Tarek <tareknaser360@gmail.com>
- Loading branch information
1 parent
44d3b7e
commit 35a2032
Showing
4 changed files
with
16 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
use clap::Parser; | ||
|
||
use coffee_core::coffee::CoffeeManager; | ||
use coffee_lib::errors::CoffeeError; | ||
use coffee_lib::macros::error; | ||
use coffee_lib::plugin_manager::PluginManager; | ||
|
||
mod cmd; | ||
pub mod httpd; | ||
|
||
#[actix_web::main] | ||
async fn main() { | ||
async fn main() -> Result<(), CoffeeError> { | ||
env_logger::init(); | ||
let cmd = cmd::HttpdArgs::parse(); | ||
let coffee = CoffeeManager::new(&cmd).await; | ||
if let Err(err) = &coffee { | ||
println!("{err}"); | ||
} | ||
let mut coffee = coffee.unwrap(); | ||
if let Err(err) = coffee.setup(&cmd.cln_path).await { | ||
println!("{err}"); | ||
} | ||
let mut coffee = CoffeeManager::new(&cmd).await?; | ||
coffee.setup(&cmd.cln_path).await?; | ||
|
||
let port = cmd.port.unwrap_or(8080) as u16; | ||
log::info!("Running on port 127.0.0.1:{port}"); | ||
if let Err(err) = httpd::run_httpd(coffee, ("127.0.0.1", port)).await { | ||
println!("{err}"); | ||
return Err(error!("Error while running the httpd: {err}")); | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters