@@ -34,8 +34,13 @@ pub struct CommandDiscovery {
34
34
35
35
#[ derive( Deserialize ) ]
36
36
pub struct ResourcePathSetting {
37
+ /// whether to allow overriding with the DSC_RESOURCE_PATH environment variable
38
+ #[ serde( rename = "allowEnvOverride" ) ]
37
39
allow_env_override : bool ,
40
+ /// whether to append the PATH environment variable to the list of resource directories
41
+ #[ serde( rename = "appendEnvPath" ) ]
38
42
append_env_path : bool ,
43
+ /// array of directories that DSC should search for non-built-in resources
39
44
directories : Vec < String >
40
45
}
41
46
@@ -60,26 +65,26 @@ impl CommandDiscovery {
60
65
61
66
fn get_resource_path_setting ( ) -> Result < ResourcePathSetting , DscError >
62
67
{
63
- if let Ok ( v) = get_setting ( "resource_path " ) {
68
+ if let Ok ( v) = get_setting ( "resourcePath " ) {
64
69
// if there is a policy value defined - use it; otherwise use setting value
65
70
if v. policy != serde_json:: Value :: Null {
66
71
match serde_json:: from_value :: < ResourcePathSetting > ( v. policy ) {
67
72
Ok ( v) => {
68
73
return Ok ( v) ;
69
74
} ,
70
- Err ( e) => { return Err ( DscError :: Operation ( format ! ( "{e}" ) ) ) ; }
75
+ Err ( e) => { return Err ( DscError :: Setting ( format ! ( "{e}" ) ) ) ; }
71
76
}
72
77
} else if v. setting != serde_json:: Value :: Null {
73
78
match serde_json:: from_value :: < ResourcePathSetting > ( v. setting ) {
74
79
Ok ( v) => {
75
80
return Ok ( v) ;
76
81
} ,
77
- Err ( e) => { return Err ( DscError :: Operation ( format ! ( "{e}" ) ) ) ; }
82
+ Err ( e) => { return Err ( DscError :: Setting ( format ! ( "{e}" ) ) ) ; }
78
83
}
79
84
}
80
85
}
81
86
82
- Err ( DscError :: Operation ( "Could not read 'resource_path ' setting" . to_string ( ) ) )
87
+ Err ( DscError :: Setting ( "Could not read 'resourcePath ' setting" . to_string ( ) ) )
83
88
}
84
89
85
90
fn get_resource_paths ( ) -> Result < Vec < PathBuf > , DscError >
@@ -112,7 +117,7 @@ impl CommandDiscovery {
112
117
}
113
118
114
119
if resource_path_setting. append_env_path {
115
- trace ! ( "Appending PATH to resource_path " ) ;
120
+ debug ! ( "Appending PATH to resourcePath " ) ;
116
121
match env:: var_os ( "PATH" ) {
117
122
Some ( value) => {
118
123
trace ! ( "Original PATH: {:?}" , value. to_string_lossy( ) ) ;
0 commit comments