Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure describe shows the service version #139

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cli/src/command/deployments/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,20 @@ impl CreateArgs {
let user = Credentials::load()?;
let client = Client::new_with_token(user.access_token);

let _: ResponseData = client.query(&request_body).await?;

println!("Deployment success 🚀");

let service = match &self.create_commands {
CreateServiceCommands::Katana(_) => "katana",
CreateServiceCommands::Torii(_) => "torii",
CreateServiceCommands::Saya(_) => "saya",
};

println!(
"Deploying {}...",
super::service_url(&self.project, service)
);

let _: ResponseData = client.query(&request_body).await?;

println!("\nDeployment success 🚀");
println!(
"\nStream logs with `slot deployments logs {} {service} -f`",
self.project
Expand Down
7 changes: 7 additions & 0 deletions cli/src/command/deployments/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@ impl DescribeArgs {
);
println!("Tier: {:?}", deployment.tier);

println!(
"Url: {}",
super::service_url(&deployment.project, &self.service.to_string())
);

match deployment.config {
ToriiConfig(config) => {
println!("Version: {}", config.version);
if let Some(config_file) = config.config_file {
print_config_file(&config_file);
}
}
KatanaConfig(config) => {
println!("Version: {}", config.version);
if let Some(config_file) = config.config_file {
print_config_file(&config_file);
}
Expand Down
7 changes: 7 additions & 0 deletions cli/src/command/deployments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ mod logs;
mod services;
mod update;

pub const CARTRIDGE_BASE_URL: &str = "https://api.cartridge.gg/x";

#[derive(Subcommand, Debug)]
pub enum Deployments {
#[command(about = "Create a new deployment.")]
Expand Down Expand Up @@ -60,6 +62,11 @@ pub enum Tier {
Epic,
}

/// Returns the service url for a given project and service.
pub(crate) fn service_url(project: &str, service: &str) -> String {
format!("{}/{}/{}", CARTRIDGE_BASE_URL, project, service)
}

/// Prints the configuration file for a given project and service.
pub(crate) fn print_config_file(config: &str) {
println!("\n─────────────── Configuration ───────────────");
Expand Down
10 changes: 10 additions & 0 deletions cli/src/command/deployments/services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,13 @@ pub enum Service {
Torii,
Saya,
}

impl std::fmt::Display for Service {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Service::Katana => write!(f, "katana"),
Service::Torii => write!(f, "torii"),
Service::Saya => write!(f, "saya"),
}
}
}
Loading