File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,9 @@ pub struct Config {
112112 pub api_key : String ,
113113 pub api_key_secret_arn : String ,
114114 pub kms_api_key : String ,
115+ #[ serde( deserialize_with = "deserialize_string_or_int" ) ]
115116 pub env : Option < String > ,
117+ #[ serde( deserialize_with = "deserialize_string_or_int" ) ]
116118 pub service : Option < String > ,
117119 #[ serde( deserialize_with = "deserialize_string_or_int" ) ]
118120 pub version : Option < String > ,
@@ -810,12 +812,19 @@ pub mod tests {
810812 }
811813
812814 #[ test]
813- fn parse_dd_version ( ) {
815+ fn parse_number_or_string_env_vars ( ) {
814816 figment:: Jail :: expect_with ( |jail| {
815817 jail. clear_env ( ) ;
816818 jail. set_env ( "DD_VERSION" , "123" ) ;
819+ jail. set_env ( "DD_ENV" , "123456890" ) ;
820+ jail. set_env ( "DD_SERVICE" , "123456" ) ;
817821 let config = get_config ( Path :: new ( "" ) , MOCK_REGION ) . expect ( "should parse config" ) ;
818822 assert_eq ! ( config. version. expect( "failed to parse DD_VERSION" ) , "123" ) ;
823+ assert_eq ! ( config. env. expect( "failed to parse DD_ENV" ) , "123456890" ) ;
824+ assert_eq ! (
825+ config. service. expect( "failed to parse DD_SERVICE" ) ,
826+ "123456"
827+ ) ;
819828 Ok ( ( ) )
820829 } ) ;
821830 }
You can’t perform that action at this time.
0 commit comments