Create workspace and move mitractl to a separate crate

This commit is contained in:
silverpill 2023-01-17 21:48:59 +00:00
parent 203582f801
commit 42329328ec
7 changed files with 62 additions and 15 deletions

View file

@ -13,6 +13,9 @@ indent_size = 2
[*.yaml]
indent_size = 2
[*.toml]
indent_size = 2
[*.md]
indent_size = 2
max_line_length = off

13
Cargo.lock generated
View file

@ -1709,7 +1709,6 @@ dependencies = [
"blake2",
"bs58",
"chrono",
"clap",
"comrak",
"deadpool",
"deadpool-postgres",
@ -1751,6 +1750,18 @@ dependencies = [
"web3",
]
[[package]]
name = "mitra-cli"
version = "1.10.0"
dependencies = [
"anyhow",
"clap",
"log",
"mitra",
"tokio",
"uuid",
]
[[package]]
name = "monero"
version = "0.17.2"

View file

@ -9,6 +9,16 @@ rust-version = "1.56"
publish = false
default-run = "mitra"
[workspace]
members = [
".",
"mitra-cli",
]
default-members = [
".",
"mitra-cli",
]
[dependencies]
# Used to handle incoming HTTP requests
actix-cors = "0.6.2"
@ -25,8 +35,6 @@ base64 = "0.13.0"
bs58 = "0.4.0"
# Used for working with dates
chrono = { version = "0.4.23", default-features = false, features = ["std", "serde"] }
# Used to build admin CLI tool
clap = { version = "3.2.18", default-features = false, features = ["std", "derive"] }
# Used for parsing markdown
comrak = { version = "0.15.0", default-features = false }
# Used for pooling database connections

24
mitra-cli/Cargo.toml Normal file
View file

@ -0,0 +1,24 @@
[package]
name = "mitra-cli"
version = "1.10.0"
license = "AGPL-3.0"
edition = "2021"
rust-version = "1.56"
[[bin]]
name = "mitractl"
path = "src/main.rs"
[dependencies]
mitra = { path = ".." }
# Used for catching errors
anyhow = "1.0.58"
# Used to build admin CLI tool
clap = { version = "3.2.18", default-features = false, features = ["std", "derive"] }
# Used for logging
log = "0.4.14"
# Async runtime
tokio = { version = "1.17.0", features = ["macros"] }
# Used to work with UUIDs
uuid = "1.1.2"

View file

@ -2,20 +2,20 @@ use anyhow::{anyhow, Error};
use clap::Parser;
use uuid::Uuid;
use crate::activitypub::{
use mitra::activitypub::{
actors::helpers::update_remote_profile,
builders::delete_note::prepare_delete_note,
builders::delete_person::prepare_delete_person,
fetcher::fetchers::fetch_actor,
};
use crate::config::Config;
use crate::database::DatabaseClient;
use crate::ethereum::{
use mitra::config::Config;
use mitra::database::DatabaseClient;
use mitra::ethereum::{
signatures::generate_ecdsa_key,
sync::save_current_block_number,
utils::key_to_ethereum_address,
};
use crate::models::{
use mitra::models::{
attachments::queries::delete_unused_attachments,
cleanup::find_orphaned_files,
emojis::helpers::get_emoji_by_name,
@ -41,11 +41,11 @@ use crate::models::{
set_user_password,
},
};
use crate::monero::{
use mitra::monero::{
helpers::check_expired_invoice,
wallet::create_monero_wallet,
};
use crate::utils::{
use mitra::utils::{
crypto_rsa::{
generate_rsa_key,
serialize_private_key,

View file

@ -1,11 +1,13 @@
use clap::Parser;
use mitra::cli::{Opts, SubCommand};
use mitra::config::parse_config;
use mitra::database::create_database_client;
use mitra::database::migrate::apply_migrations;
use mitra::logger::configure_logger;
mod cli;
use cli::{Opts, SubCommand};
#[tokio::main]
async fn main() {
let opts: Opts = Opts::parse();

View file

@ -1,6 +1,5 @@
pub mod activitypub;
pub mod atom;
pub mod cli;
pub mod config;
pub mod database;
mod errors;
@ -13,9 +12,9 @@ pub mod job_queue;
mod json_signatures;
pub mod logger;
pub mod mastodon_api;
mod models;
mod monero;
pub mod models;
pub mod monero;
pub mod nodeinfo;
mod utils;
pub mod utils;
pub mod webfinger;
pub mod web_client;