File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ pub const GCS_BUCKET: &str = "sbe-gcs-bucket";
16
16
pub const GCS_KEY_FILE : & str = "sbe-gcs-key-file" ;
17
17
pub const HTTP_BIND_ADDRESS : & str = "bind-address-http" ;
18
18
pub const IDLE_SESSION_TIMEOUT : & str = "idle-session-timeout" ;
19
+ pub const INSTANCE_NAME : & str = "instance-name" ;
19
20
pub const PASSIVE_PORTS : & str = "passive-ports" ;
20
21
pub const PROXY_EXTERNAL_CONTROL_PORT : & str = "proxy-external-control-port" ;
21
22
pub const REDIS_HOST : & str = "log-redis-host" ;
@@ -126,6 +127,15 @@ pub(crate) fn clap_app(tmp_dir: &str) -> clap::App {
126
127
. takes_value ( true )
127
128
. default_value ( "0.0.0.0:8080" ) ,
128
129
)
130
+ . arg (
131
+ Arg :: with_name ( INSTANCE_NAME )
132
+ . long ( "instance-name" )
133
+ . value_name ( "NAME" )
134
+ . help ( "Gives a user friendly name to this instance. This is for used for example as part of the app name during logging." )
135
+ . env ( "UNFTP_INSTANCE_NAME" )
136
+ . takes_value ( true )
137
+ . default_value ( "unFTP" ) ,
138
+ )
129
139
. arg (
130
140
Arg :: with_name ( PASSIVE_PORTS )
131
141
. long ( "passive-ports" )
Original file line number Diff line number Diff line change @@ -41,7 +41,13 @@ fn redis_logger(m: &clap::ArgMatches) -> Result<Option<redislog::Logger>, String
41
41
m. value_of ( args:: REDIS_PORT ) ,
42
42
) {
43
43
( Some ( key) , Some ( host) , Some ( port) ) => {
44
- let logger = redislog:: Builder :: new ( app:: NAME )
44
+ let instance_name = m. value_of ( args:: INSTANCE_NAME ) . unwrap ( ) ;
45
+ let app_name = if instance_name == app:: NAME {
46
+ String :: from ( app:: NAME )
47
+ } else {
48
+ format ! ( "{}-{}" , app:: NAME , instance_name)
49
+ } ;
50
+ let logger = redislog:: Builder :: new ( & * app_name)
45
51
. redis (
46
52
String :: from ( host) ,
47
53
String :: from ( port) . parse :: < u32 > ( ) . unwrap ( ) ,
You can’t perform that action at this time.
0 commit comments