Skip to content

Commit

Permalink
#54 dockerhub command
Browse files Browse the repository at this point in the history
  • Loading branch information
smart--petea committed Apr 17, 2024
1 parent 592ef6f commit fa1b3f8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/console/commands/debug/casbin.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::configuration::get_configuration;
use actix_web::{rt, post, web, HttpResponse, Result, http::header::ContentType};
use crate::middleware;
//use actix_casbin_auth::casbin::CoreApi;
use casbin::CoreApi;
use sqlx::PgPool;

Expand Down
21 changes: 21 additions & 0 deletions src/console/commands/debug/dockerhub.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use actix_web::{rt, Result};

pub struct DockerhubCommand {
json: String,
}

impl DockerhubCommand {
pub fn new(json: String) -> Self {
Self { json }
}
}

impl crate::console::commands::CallableTrait for DockerhubCommand {
fn call(&self) -> Result<(), Box<dyn std::error::Error>> {
rt::System::new().block_on(async {
println!("{}", self.json);

Ok(())
})
}
}
2 changes: 2 additions & 0 deletions src/console/commands/debug/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mod json;
mod casbin;
mod dockerhub;

pub use json::*;
pub use casbin::*;
pub use dockerhub::*;
7 changes: 7 additions & 0 deletions src/console/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ enum DebugCommands {
#[arg(long)]
subject: String,
},
Dockerhub {
#[arg(long)]
json: String,
}
}

#[derive(Debug, Subcommand)]
Expand Down Expand Up @@ -76,6 +80,9 @@ fn get_command(cli: Cli) -> Result<Box<dyn stacker::console::commands::CallableT
DebugCommands::Casbin { action, path, subject } => Ok(Box::new(
stacker::console::commands::debug::CasbinCommand::new(action, path, subject),
)),
DebugCommands::Dockerhub { json } => Ok(Box::new(
stacker::console::commands::debug::DockerhubCommand::new(json),
)),
},
Commands::MQ { command} => match command {
AppMqCommands::Listen {} => Ok(Box::new(
Expand Down

0 comments on commit fa1b3f8

Please sign in to comment.