Skip to content

Commit 046eff4

Browse files
committed
Cleanup the banner
1 parent 0651ffa commit 046eff4

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

server/src/banner.rs

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,66 +20,65 @@
2020
use crossterm::style::Stylize;
2121

2222
use crate::{option::Config, storage::StorageMetadata};
23+
use crate::utils::{uid::Uid};
2324

2425
pub fn print(config: &Config, meta: StorageMetadata) {
2526
let scheme = config.parseable.get_scheme();
26-
status_info(config, &scheme);
27+
status_info(config, &scheme, meta.deployment_id);
2728
storage_info(config);
28-
version::print(meta.deployment_id);
29+
about::print();
2930
println!();
3031
}
3132

32-
fn status_info(config: &Config, scheme: &str) {
33+
fn status_info(config: &Config, scheme: &str, id: Uid) {
3334
let url = format!("{}://{}", scheme, config.parseable.address).underlined();
34-
eprintln!(
35-
"
36-
{}
37-
{}
38-
{}",
39-
format!("Parseable server started at: {}", url).bold(),
40-
format!("Username: {}", config.parseable.username).bold(),
41-
format!("Password: {}", config.parseable.password).bold(),
42-
);
43-
4435
if config.is_default_creds() {
45-
warning_line();
4636
eprintln!(
4737
"
48-
{}",
49-
"Using default credentials for Parseable server".red()
50-
)
38+
{}
39+
Running at: \"{}\"
40+
Credentials: {}
41+
Deployment UID: \"{}\"",
42+
"Parseable Server".to_string().bold(),
43+
url,
44+
"\"Using default creds admin, admin. Please set credentials with P_USERNAME and P_PASSWORD.\"".to_string().red(),
45+
id.to_string()
46+
);
47+
} else {
48+
eprintln!(
49+
"
50+
{}
51+
Running at: \"{}\"
52+
Credentials: \"As set in P_USERNAME and P_PASSWORD environment variables\"
53+
Deployment UID: \"{}\"",
54+
"Parseable Server".to_string().bold(),
55+
url,
56+
id.to_string(),
57+
);
5158
}
5259
}
5360

5461
fn storage_info(config: &Config) {
5562
eprintln!(
5663
"
5764
{}
58-
Mode: {}
59-
Staging path: {}
60-
Store path: {}",
61-
"Storage:".to_string().blue().bold(),
65+
Mode: \"{}\"
66+
Staging: \"{}\"
67+
Store: \"{}\"",
68+
"Storage:".to_string().cyan().bold(),
6269
config.storage_name,
6370
config.staging_dir().to_string_lossy(),
6471
config.storage().get_endpoint(),
6572
)
6673
}
6774

68-
pub fn warning_line() {
69-
eprint!(
70-
"
71-
{}",
72-
"Warning:".to_string().red().bold(),
73-
);
74-
}
75-
76-
pub mod version {
75+
pub mod about {
7776
use chrono::Duration;
7877
use chrono_humanize::{Accuracy, Tense};
7978
use crossterm::style::Stylize;
8079
use std::fmt;
8180

82-
use crate::utils::{uid::Uid, update};
81+
use crate::utils::update;
8382

8483
pub enum ParseableVersion {
8584
Version(semver::Version),
@@ -95,29 +94,26 @@ pub mod version {
9594
}
9695
}
9796

98-
pub fn print_version(current_version: semver::Version, commit_hash: String, id: Uid) {
97+
pub fn print_version(current_version: semver::Version, commit_hash: String) {
9998
eprint!(
10099
"
101100
{}
102-
Deployment ID: {}
103-
Version: {}
104-
Commit hash: {}
105-
GitHub: https://github.com/parseablehq/parseable
106-
Docs: https://www.parseable.io/docs/introduction",
101+
Version: \"{}\"
102+
Commit: \"{}\"
103+
Docs: \"https://www.parseable.io/docs/introduction\"",
107104
"About:".to_string().blue().bold(),
108-
id.to_string(),
109105
current_version,
110106
commit_hash
111107
);
112108
}
113109

114-
pub fn print(id: Uid) {
110+
pub fn print() {
115111
// print current version
116112
let current = current();
117113

118114
match current.0 {
119115
ParseableVersion::Version(current_version) => {
120-
print_version(current_version.clone(), current.1, id);
116+
print_version(current_version.clone(), current.1);
121117
// check for latest release, if it cannot be fetched then print error as warn and return
122118
let latest_release = match update::get_latest() {
123119
Ok(latest_release) => latest_release,

server/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub mod uid {
133133
}
134134

135135
pub mod update {
136-
use crate::banner::version::current;
136+
use crate::banner::about::current;
137137
use std::{path::Path, time::Duration};
138138

139139
use anyhow::anyhow;

0 commit comments

Comments
 (0)