chore: standardize agent main files

buddies-main-deployment
James Prestwich 3 years ago
parent aff52ce2a9
commit b2cdab4721
No known key found for this signature in database
GPG Key ID: 7CC174C250AD83AD
  1. 5
      rust/kathy/src/main.rs
  2. 18
      rust/processor/src/main.rs
  3. 19
      rust/relayer/src/main.rs
  4. 19
      rust/updater/src/main.rs
  5. 19
      rust/watcher/src/main.rs

@ -15,12 +15,11 @@ use crate::{kathy::Kathy, settings::KathySettings as Settings};
async fn _main() -> Result<()> {
color_eyre::install()?;
let settings = Settings::new()?;
settings.base.tracing.try_init_tracing()?;
let kathy = Kathy::from_settings(settings).await?;
kathy.run_all().await?;
let agent = Kathy::from_settings(settings).await?;
agent.run_all().await?;
Ok(())
}

@ -17,26 +17,20 @@ use color_eyre::Result;
use crate::{processor::Processor, settings::ProcessorSettings as Settings};
use optics_base::agent::OpticsAgent;
async fn _main(settings: Settings) -> Result<()> {
let processor = Processor::from_settings(settings).await?;
processor.run_all().await?;
Ok(())
}
fn setup() -> Result<Settings> {
async fn _main() -> Result<()> {
color_eyre::install()?;
let settings = Settings::new()?;
settings.base.tracing.try_init_tracing()?;
Ok(settings)
let agent = Processor::from_settings(settings).await?;
agent.run_all().await?;
Ok(())
}
fn main() -> Result<()> {
let settings = setup()?;
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(_main(settings))
.block_on(_main())
}

@ -19,29 +19,20 @@ use optics_base::agent::OpticsAgent;
use crate::{relayer::Relayer, settings::RelayerSettings as Settings};
async fn _main(settings: Settings) -> Result<()> {
let relayer = Relayer::from_settings(settings).await?;
relayer.run_all().await?;
Ok(())
}
fn setup() -> Result<Settings> {
async fn _main() -> Result<()> {
color_eyre::install()?;
let settings = Settings::new()?;
settings.base.tracing.try_init_tracing()?;
Ok(settings)
let agent = Relayer::from_settings(settings).await?;
agent.run_all().await?;
Ok(())
}
fn main() -> Result<()> {
let settings = setup()?;
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(_main(settings))
.block_on(_main())
}

@ -16,29 +16,20 @@ use optics_base::agent::OpticsAgent;
use crate::{settings::UpdaterSettings as Settings, updater::Updater};
async fn _main(settings: Settings) -> Result<()> {
let updater = Updater::from_settings(settings).await?;
updater.run("").await??;
Ok(())
}
fn setup() -> Result<Settings> {
async fn _main() -> Result<()> {
color_eyre::install()?;
let settings = Settings::new()?;
settings.base.tracing.try_init_tracing()?;
Ok(settings)
let agent = Updater::from_settings(settings).await?;
agent.run_all().await?;
Ok(())
}
fn main() -> Result<()> {
let settings = setup()?;
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(_main(settings))
.block_on(_main())
}

@ -18,29 +18,20 @@ use optics_base::agent::OpticsAgent;
use crate::{settings::WatcherSettings as Settings, watcher::Watcher};
async fn _main(settings: Settings) -> Result<()> {
let watcher = Watcher::from_settings(settings).await?;
watcher.run_all().await?;
Ok(())
}
fn setup() -> Result<Settings> {
async fn _main() -> Result<()> {
color_eyre::install()?;
let settings = Settings::new()?;
settings.base.tracing.try_init_tracing()?;
Ok(settings)
let agent = Watcher::from_settings(settings).await?;
agent.run_all().await?;
Ok(())
}
fn main() -> Result<()> {
let settings = setup()?;
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(_main(settings))
.block_on(_main())
}

Loading…
Cancel
Save