generated from Patagia/template-nix
Compare commits
1 commit
00128e39ce
...
9cac938fb5
Author | SHA1 | Date | |
---|---|---|---|
9cac938fb5 |
1 changed files with 7 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
use anyhow::Result;
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
use dropshot::endpoint;
|
||||
use dropshot::ApiDescription;
|
||||
|
@ -24,7 +24,6 @@ struct Cli {}
|
|||
/// Represents a project in our API.
|
||||
#[derive(Serialize, JsonSchema)]
|
||||
struct VersionInfo {
|
||||
/// Name of the project.
|
||||
name: String,
|
||||
}
|
||||
|
||||
|
@ -41,7 +40,7 @@ async fn api_version(rqctx: RequestContext<Arc<()>>) -> Result<HttpResponseOk<Ve
|
|||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), String> {
|
||||
async fn main() -> Result<()> {
|
||||
let _args = Cli::parse();
|
||||
let fmt_layer = tracing_subscriber::fmt::layer();
|
||||
|
||||
|
@ -64,11 +63,12 @@ async fn main() -> Result<(), String> {
|
|||
tracing::info!("Patagia Controller");
|
||||
|
||||
let mut api = ApiDescription::new();
|
||||
api.register(api_version).map_err(|e| e.to_string())?;
|
||||
api.register(api_version).unwrap();
|
||||
|
||||
let server = ServerBuilder::new(api, Arc::new(()), dropshot_logger)
|
||||
let server =ServerBuilder::new(api, Arc::new(()), dropshot_logger)
|
||||
.config(config_dropshot)
|
||||
.start()
|
||||
.map_err(|e| e.to_string())?;
|
||||
server.await
|
||||
.map_err(|e| anyhow!("Error starting server: {:?}", e))?;
|
||||
|
||||
server.await.map_err(|e| anyhow!("Error running server: {}", e))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue