1919
2020use crossterm:: style:: Stylize ;
2121
22+ use crate :: utils:: uid:: Uid ;
2223use crate :: { option:: Config , storage:: StorageMetadata } ;
2324
2425pub 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- let url = format ! ( "{}://{}" , scheme, config. parseable. address) . underlined ( ) ;
33+ fn status_info ( config : & Config , scheme : & str , id : Uid ) {
34+ let url = format ! ( "\" {}://{}\" " , scheme, config. parseable. address) . underlined ( ) ;
35+ let mut credentials =
36+ String :: from ( "\" As set in P_USERNAME and P_PASSWORD environment variables\" " ) ;
37+
38+ if config. is_default_creds ( ) {
39+ credentials = "\" Using default creds admin, admin. Please set credentials with P_USERNAME and P_PASSWORD.\" " . red ( ) . to_string ( ) ;
40+ }
41+
3442 eprintln ! (
3543 "
3644 {}
37- {}
38- {}" ,
39- format!( "Parseable server started at: {}" , url) . bold( ) ,
40- format!( "Username: {}" , config. parseable. username) . bold( ) ,
41- format!( "Password: {}" , config. parseable. password) . bold( ) ,
45+ Running at: {}
46+ Credentials: {}
47+ Deployment UID: \" {}\" " ,
48+ "Parseable Server" . to_string( ) . bold( ) ,
49+ url,
50+ credentials,
51+ id. to_string( ) ,
4252 ) ;
43-
44- if config. is_default_creds ( ) {
45- warning_line ( ) ;
46- eprintln ! (
47- "
48- {}" ,
49- "Using default credentials for Parseable server" . red( )
50- )
51- }
5253}
5354
5455fn storage_info ( config : & Config ) {
56+ let mut mode = "S3 bucket" ;
57+ if config. storage_name == "drive" {
58+ mode = "Local drive" ;
59+ }
5560 eprintln ! (
5661 "
5762 {}
58- Mode: {}
59- Staging path : {}
60- Store path : {} " ,
61- "Storage:" . to_string( ) . blue ( ) . bold( ) ,
62- config . storage_name ,
63+ Mode: \" {} \"
64+ Staging: \" {} \"
65+ Store: \" {} \" " ,
66+ "Storage:" . to_string( ) . cyan ( ) . bold( ) ,
67+ mode ,
6368 config. staging_dir( ) . to_string_lossy( ) ,
6469 config. storage( ) . get_endpoint( ) ,
6570 )
6671}
6772
68- pub fn warning_line ( ) {
69- eprint ! (
70- "
71- {}" ,
72- "Warning:" . to_string( ) . red( ) . bold( ) ,
73- ) ;
74- }
75-
76- pub mod version {
73+ pub mod about {
7774 use chrono:: Duration ;
7875 use chrono_humanize:: { Accuracy , Tense } ;
7976 use crossterm:: style:: Stylize ;
8077 use std:: fmt;
8178
82- use crate :: utils:: { uid :: Uid , update} ;
79+ use crate :: utils:: update;
8380
8481 pub enum ParseableVersion {
8582 Version ( semver:: Version ) ,
@@ -95,29 +92,26 @@ pub mod version {
9592 }
9693 }
9794
98- pub fn print_version ( current_version : semver:: Version , commit_hash : String , id : Uid ) {
95+ pub fn print_version ( current_version : semver:: Version , commit_hash : String ) {
9996 eprint ! (
10097 "
10198 {}
102- Deployment ID: {}
103- Version: {}
104- Commit hash: {}
105- GitHub: https://github.com/parseablehq/parseable
106- Docs: https://www.parseable.io/docs/introduction" ,
107- "About:" . to_string( ) . blue( ) . bold( ) ,
108- id. to_string( ) ,
99+ Version: \" {}\"
100+ Commit: \" {}\"
101+ Docs: \" https://www.parseable.io/docs/introduction\" " ,
102+ "About:" . to_string( ) . bold( ) ,
109103 current_version,
110104 commit_hash
111105 ) ;
112106 }
113107
114- pub fn print ( id : Uid ) {
108+ pub fn print ( ) {
115109 // print current version
116110 let current = current ( ) ;
117111
118112 match current. 0 {
119113 ParseableVersion :: Version ( current_version) => {
120- print_version ( current_version. clone ( ) , current. 1 , id ) ;
114+ print_version ( current_version. clone ( ) , current. 1 ) ;
121115 // check for latest release, if it cannot be fetched then print error as warn and return
122116 let latest_release = match update:: get_latest ( ) {
123117 Ok ( latest_release) => latest_release,
0 commit comments