19
19
20
20
use crossterm:: style:: Stylize ;
21
21
22
+ use crate :: utils:: uid:: Uid ;
22
23
use crate :: { option:: Config , storage:: StorageMetadata } ;
23
24
24
25
pub fn print ( config : & Config , meta : StorageMetadata ) {
25
26
let scheme = config. parseable . get_scheme ( ) ;
26
- status_info ( config, & scheme) ;
27
+ status_info ( config, & scheme, meta . deployment_id ) ;
27
28
storage_info ( config) ;
28
- version :: print ( meta . deployment_id ) ;
29
+ about :: print ( ) ;
29
30
println ! ( ) ;
30
31
}
31
32
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
+
34
42
eprintln ! (
35
43
"
36
44
{}
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( ) ,
42
52
) ;
43
-
44
- if config. is_default_creds ( ) {
45
- warning_line ( ) ;
46
- eprintln ! (
47
- "
48
- {}" ,
49
- "Using default credentials for Parseable server" . red( )
50
- )
51
- }
52
53
}
53
54
54
55
fn storage_info ( config : & Config ) {
56
+ let mut mode = "S3 bucket" ;
57
+ if config. storage_name == "drive" {
58
+ mode = "Local drive" ;
59
+ }
55
60
eprintln ! (
56
61
"
57
62
{}
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 ,
63
68
config. staging_dir( ) . to_string_lossy( ) ,
64
69
config. storage( ) . get_endpoint( ) ,
65
70
)
66
71
}
67
72
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 {
77
74
use chrono:: Duration ;
78
75
use chrono_humanize:: { Accuracy , Tense } ;
79
76
use crossterm:: style:: Stylize ;
80
77
use std:: fmt;
81
78
82
- use crate :: utils:: { uid :: Uid , update} ;
79
+ use crate :: utils:: update;
83
80
84
81
pub enum ParseableVersion {
85
82
Version ( semver:: Version ) ,
@@ -95,29 +92,26 @@ pub mod version {
95
92
}
96
93
}
97
94
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 ) {
99
96
eprint ! (
100
97
"
101
98
{}
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( ) ,
109
103
current_version,
110
104
commit_hash
111
105
) ;
112
106
}
113
107
114
- pub fn print ( id : Uid ) {
108
+ pub fn print ( ) {
115
109
// print current version
116
110
let current = current ( ) ;
117
111
118
112
match current. 0 {
119
113
ParseableVersion :: Version ( current_version) => {
120
- print_version ( current_version. clone ( ) , current. 1 , id ) ;
114
+ print_version ( current_version. clone ( ) , current. 1 ) ;
121
115
// check for latest release, if it cannot be fetched then print error as warn and return
122
116
let latest_release = match update:: get_latest ( ) {
123
117
Ok ( latest_release) => latest_release,
0 commit comments