Skip to content

Commit

Permalink
Merge pull request #56 from runtipi/develop
Browse files Browse the repository at this point in the history
Sync to main
  • Loading branch information
nicotsx authored Sep 25, 2024
2 parents a11b023 + 322a368 commit a276a38
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 32 deletions.
11 changes: 6 additions & 5 deletions src/args.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::fmt;
use semver::{Error as SemverError, Version};
use std::{path::PathBuf, str::FromStr};

Expand Down Expand Up @@ -28,12 +29,12 @@ impl FromStr for VersionEnum {
}
}

impl ToString for VersionEnum {
fn to_string(&self) -> String {
impl fmt::Display for VersionEnum {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
VersionEnum::Version(version) => version.to_string(),
VersionEnum::Latest => "latest".to_string(),
VersionEnum::Nightly => "nightly".to_string(),
VersionEnum::Version(version) => write!(f, "{}", version),
VersionEnum::Latest => write!(f, "latest"),
VersionEnum::Nightly => write!(f, "nightly"),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/assets/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
depends_on:
runtipi:
condition: service_healthy
image: traefik:v3.0
image: traefik:v3.1.4
restart: unless-stopped
ports:
- ${NGINX_PORT:-80}:80
Expand Down
16 changes: 8 additions & 8 deletions src/commands/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn run(args: AppCommand, env_map: EnvMap) {
}
Err(err) => {
spin.fail("Failed to start app.");
println!("{}", format!("Error: {}", err));
println!("Error: {}", err);
}
}
spin.finish();
Expand All @@ -48,7 +48,7 @@ pub fn run(args: AppCommand, env_map: EnvMap) {
}
Err(err) => {
spin.fail("Failed to stop app.");
println!("{}", format!("Error: {}", err));
println!("Error: {}", err);
}
}
spin.finish();
Expand All @@ -68,7 +68,7 @@ pub fn run(args: AppCommand, env_map: EnvMap) {
}
Err(err) => {
spin.fail("Failed to uninstall app.");
println!("{}", format!("Error: {}", err));
println!("Error: {}", err);
}
}
spin.finish();
Expand All @@ -91,7 +91,7 @@ pub fn run(args: AppCommand, env_map: EnvMap) {
Err(err) => {
spin.fail("Failed to reset app.");
spin.finish();
println!("{}", format!("Error: {}", err));
println!("Error: {}", err);
}
}
}
Expand All @@ -113,29 +113,29 @@ pub fn run(args: AppCommand, env_map: EnvMap) {
Err(err) => {
spin.fail("Failed to update app.");
spin.finish();
println!("{}", format!("Error: {}", err));
println!("Error: {}", err);
}
}
}
AppSubcommand::StartAll(_) => {
let spin = spinner::new("Starting all apps...");
let api_response = api_request(format!("{}/{}", base_url, "start-all"));
let error_message = format!("Failed to start apps. See logs/error.log for more details.");
let error_message = "Failed to start apps. See logs/error.log for more details.";

match api_response {
Ok(response) => {
if response.status().is_success() {
spin.succeed("All apps started successfully!!");
spin.finish();
} else {
spin.fail(&error_message);
spin.fail(error_message);
spin.finish();
}
}
Err(err) => {
spin.fail("Failed to start apps.");
spin.finish();
println!("{}", format!("Error: {}", err));
println!("Error: {}", err);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/commands/reset_password.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub fn run() {
.unwrap_or("./state/password-change-request"),
e
);
return;
}
}
}
22 changes: 9 additions & 13 deletions src/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,9 @@ pub fn run(args: UpdateArgs) {
run_args.push("--no-permissions".to_string());
}

match args.env_file {
Some(env_file) => {
run_args.push("--env-file".to_string());
run_args.push(env_file.display().to_string());
}
None => {}
if let Some(env_file) = args.env_file {
run_args.push("--env-file".to_string());
run_args.push(env_file.display().to_string());
}

// Run command start on new CLI
Expand All @@ -122,15 +119,14 @@ pub fn run(args: UpdateArgs) {

let internal_ip = get_env_value("INTERNAL_IP").unwrap_or("localhost".to_string());
let nginx_port = get_env_value("NGINX_PORT").unwrap_or("80".to_string());
let ip_and_port = format!("Visit http://{}:{} to access the dashboard", internal_ip, nginx_port);

let box_title = "Runtipi started successfully".to_string();
let box_body = format!(
"{}\n\n{}\n\n{}",
ip_and_port,
format!("You are now running version {}", release.version),
"Tipi is entirely written in TypeScript and we are looking for contributors!"
);

let ip_and_port = format!("Visit http://{}:{} to access the dashboard", internal_ip, nginx_port);
let message = format!("You are now running version {}", release.version);
let shameless_plug = "Tipi is entirely written in TypeScript and we are looking for contributors!";

let box_body = format!("{}\n\n{}\n\n{}", ip_and_port, message, shameless_plug);

let console_box = ConsoleBox::new(box_title, box_body, 80, "green".to_string());
console_box.print();
Expand Down
2 changes: 1 addition & 1 deletion src/components/console_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl ConsoleBox {
current_line = String::new();
}
current_line.push_str(word);
current_line.push_str(" ");
current_line.push(' ');
}
split_lines.push(current_line);
for line in split_lines {
Expand Down
4 changes: 1 addition & 3 deletions src/components/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,5 @@ impl CustomSpinner {
}

pub fn new(message: &str) -> CustomSpinner {
let spinner = CustomSpinner::new(message.to_string());

return spinner;
CustomSpinner::new(message.to_string())
}

0 comments on commit a276a38

Please sign in to comment.