@@ -26,9 +26,9 @@ struct Config {
2626 #[ env_config( default = "192.168.2.1" ) ]
2727 server_addr : String ,
2828 server_mode : bool ,
29- #[ env_config( name = "ZINC_ENABLE " , default = true , help = "this is important" ) ]
29+ #[ env_config( name = "CONF_ENABLE " , default = true , help = "this is important" ) ]
3030 enable : bool ,
31- #[ env_config( name = "ZINC_NUMBER " , default = 123456 ) ]
31+ #[ env_config( name = "CONF_NUMBER " , default = 123456 ) ]
3232 num : Option < i64 > ,
3333 rr : Redis ,
3434 #[ env_config( parse, default = "green" ) ]
@@ -40,7 +40,7 @@ struct Redis {
4040 addr : String ,
4141 port : String ,
4242 auth : String ,
43- #[ env_config( name = "ZINC_REDIS_TIMEOUT " , default = 30 ) ]
43+ #[ env_config( name = "CONF_REDIS_TIMEOUT " , default = 30 ) ]
4444 timeout : i32 ,
4545}
4646
@@ -60,14 +60,14 @@ fn test_config() {
6060
6161 let help_keys = Config :: get_help ( ) ;
6262 println ! ( "help_keys: {:?}" , help_keys) ;
63- assert ! ( help_keys. contains_key( "ZINC_ENABLE " ) ) ;
64- assert ! ( help_keys. contains_key( "ZINC_NUMBER " ) ) ;
63+ assert ! ( help_keys. contains_key( "CONF_ENABLE " ) ) ;
64+ assert ! ( help_keys. contains_key( "CONF_NUMBER " ) ) ;
6565
66- let keys = help_keys. get ( "ZINC_NUMBER " ) . unwrap ( ) ;
66+ let keys = help_keys. get ( "CONF_NUMBER " ) . unwrap ( ) ;
6767 assert_eq ! ( keys. 0 , "123456" ) ; // default value
6868 assert_eq ! ( keys. 1 , None ) ; // help value
6969
70- let keys = help_keys. get ( "ZINC_ENABLE " ) . unwrap ( ) ;
70+ let keys = help_keys. get ( "CONF_ENABLE " ) . unwrap ( ) ;
7171 assert_eq ! ( keys. 0 , "true" ) ; // default value
7272 assert_eq ! ( keys. 1 , Some ( "this is important" . to_string( ) ) ) ; // help value
7373}
0 commit comments