Skip to content

Commit

Permalink
bin: server: Use the new get_configuration_for_binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Sep 6, 2024
1 parent f6216a5 commit 785f042
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions core/src/bin/server.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
use clementine_core::servers::create_aggregator_server;
use clementine_core::servers::create_operator_server;
use clementine_core::servers::create_verifier_server;
use clementine_core::{cli, database::common::Database, extended_rpc::ExtendedRpc};
use clementine_core::utils::get_configuration_for_binaries;
use clementine_core::{database::common::Database, extended_rpc::ExtendedRpc};
use std::process::exit;

#[tokio::main]
async fn main() {
let args = match cli::parse() {
Ok(args) => args,
Err(e) => {
eprintln!("{e}");
exit(1);
}
};
let (mut config, args) = get_configuration_for_binaries();

if !args.verifier_server && !args.operator_server && !args.aggregator_server {
eprintln!("No servers are specified. Please specify one.");
exit(1);
}

let mut config = cli::get_configuration();
let rpc = ExtendedRpc::<bitcoincore_rpc::Client>::new(
config.bitcoin_rpc_url.clone(),
config.bitcoin_rpc_user.clone(),
Expand All @@ -37,7 +36,7 @@ async fn main() {
);
config.port += 1;

tracing::trace!("Verifier servers are started.");
println!("Verifier server is started.");
}

if args.operator_server {
Expand All @@ -50,16 +49,13 @@ async fn main() {
);
config.port += 1;

tracing::trace!("Operator servers are started.");
println!("Operator server is started.");
}

if args.aggregator_server {
handles.push(create_aggregator_server(config).await.unwrap().1.stopped());
}

if !args.verifier_server && !args.operator_server && !args.aggregator_server {
eprintln!("No servers are specified. Please specify one.");
exit(1);
println!("Aggregator server is started.");
}

futures::future::join_all(handles).await;
Expand Down

0 comments on commit 785f042

Please sign in to comment.