Personal ATProto tools.
1//! Main entrypoint.
2
3use sqlx::sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePool};
4use std::str::FromStr;
5
6#[tokio::main(flavor = "current_thread")]
7async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
8 let subscriber = tracing_subscriber::fmt()
9 .compact() // Use a more compact, abbreviated log format
10 .with_file(true) // Display source code file paths
11 .with_line_number(true) // Display source code line numbers
12 .with_thread_ids(true) // Display the thread ID an event was recorded on
13 .with_target(false) // Don't display the event's target (module path)
14 .finish(); // Build the subscriber
15 tracing::subscriber::set_global_default(subscriber)?;
16
17 const NEGATION_ID: &str = "did:plc:"; // TODO: Argumentize this.
18 let mut agent = atproto_teq::webrequest::Agent::default();
19 let pool_opts = SqliteConnectOptions::from_str("sqlite://prod.db").expect("Expected to be able to configure the database, but failed.")
20 .journal_mode(SqliteJournalMode::Wal);
21 let pool = SqlitePool::connect_with(pool_opts).await.expect("Expected to be able to connect to the database at sqlite://prod.db but failed.");
22 atproto_teq::database::negation(NEGATION_ID, &mut agent, &pool).await?;
23 Ok(())
24}