WIP
This commit is contained in:
parent
b956bdbf05
commit
4f2ca517d2
3 changed files with 42 additions and 7 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
|
@ -22,7 +22,12 @@ name = "admin_cli"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"argh",
|
||||||
|
"env_logger",
|
||||||
"fully_pub",
|
"fully_pub",
|
||||||
|
"kernel",
|
||||||
|
"log",
|
||||||
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,16 @@
|
||||||
name = "admin_cli"
|
name = "admin_cli"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
anyhow = { workspace = true }
|
|
||||||
fully_pub = { workspace = true }
|
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "minauthator-admin"
|
name = "minauthator-admin"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = { workspace = true }
|
||||||
|
fully_pub = { workspace = true }
|
||||||
|
argh = { workspace = true }
|
||||||
|
tokio = { workspace = true }
|
||||||
|
log = { workspace = true }
|
||||||
|
env_logger = { workspace = true }
|
||||||
|
|
||||||
|
kernel = { path = "../kernel" }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,30 @@
|
||||||
use anyhow::Result;
|
use argh::FromArgs;
|
||||||
|
use anyhow::{Context, Result};
|
||||||
|
use kernel::{context::{get_kernel_context, StartKernelConfig}};
|
||||||
|
use log::info;
|
||||||
|
|
||||||
|
#[derive(Debug, FromArgs)]
|
||||||
|
/// Minauthator admin CLI args
|
||||||
|
struct AdminCliArgs {
|
||||||
|
/// path to YAML config file to use to configure this instance
|
||||||
|
#[argh(option)]
|
||||||
|
config: Option<String>,
|
||||||
|
|
||||||
|
/// path to the Sqlite3 DB file to use
|
||||||
|
#[argh(option)]
|
||||||
|
database: Option<String>,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// handle CLI arguments to run admin CLI
|
||||||
|
#[tokio::main]
|
||||||
|
pub async fn main() -> Result<()> {
|
||||||
|
info!("Starting minauth");
|
||||||
|
let args: AdminCliArgs = argh::from_env();
|
||||||
|
let (config, secrets, db_pool) = get_kernel_context(StartKernelConfig {
|
||||||
|
config_path: args.config,
|
||||||
|
database_path: args.database
|
||||||
|
}).await.context("Getting kernel context")?;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
|
||||||
println!("Starting minauthator admin CLI");
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue