@@ -19,15 +19,13 @@ internal class EasyLoggingConfigFinder
19
19
internal const string ClientConfigEnvironmentName = "SF_CLIENT_CONFIG_FILE" ;
20
20
21
21
private readonly FileOperations _fileOperations ;
22
- private readonly UnixOperations _unixOperations ;
23
22
private readonly EnvironmentOperations _environmentOperations ;
24
23
25
- public static readonly EasyLoggingConfigFinder Instance = new EasyLoggingConfigFinder ( FileOperations . Instance , UnixOperations . Instance , EnvironmentOperations . Instance ) ;
24
+ public static readonly EasyLoggingConfigFinder Instance = new EasyLoggingConfigFinder ( FileOperations . Instance , EnvironmentOperations . Instance ) ;
26
25
27
- internal EasyLoggingConfigFinder ( FileOperations fileOperations , UnixOperations unixFileOperations , EnvironmentOperations environmentOperations )
26
+ internal EasyLoggingConfigFinder ( FileOperations fileOperations , EnvironmentOperations environmentOperations )
28
27
{
29
28
_fileOperations = fileOperations ;
30
- _unixOperations = unixFileOperations ;
31
29
_environmentOperations = environmentOperations ;
32
30
}
33
31
@@ -38,16 +36,12 @@ internal EasyLoggingConfigFinder()
38
36
public virtual string FindConfigFilePath ( string configFilePathFromConnectionString )
39
37
{
40
38
var configFilePath = GetFilePathFromInputParameter ( configFilePathFromConnectionString , "connection string" )
41
- ?? GetFilePathEnvironmentVariable ( )
42
- ?? GetFilePathFromDriverLocation ( )
43
- ?? GetFilePathFromHomeDirectory ( ) ;
44
- if ( configFilePath != null )
45
- {
46
- CheckIfValidPermissions ( configFilePath ) ;
47
- }
39
+ ?? GetFilePathEnvironmentVariable ( )
40
+ ?? GetFilePathFromDriverLocation ( )
41
+ ?? GetFilePathFromHomeDirectory ( ) ;
48
42
return configFilePath ;
49
43
}
50
-
44
+
51
45
private string GetFilePathEnvironmentVariable ( )
52
46
{
53
47
var filePath = _environmentOperations . GetEnvironmentVariable ( ClientConfigEnvironmentName ) ;
@@ -100,19 +94,5 @@ private string OnlyIfFileExists(string filePath, string directoryDescription)
100
94
}
101
95
return null ;
102
96
}
103
-
104
- private void CheckIfValidPermissions ( string filePath )
105
- {
106
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
107
- return ;
108
-
109
- // Check if others have permissions to modify the file and fail if so
110
- if ( _unixOperations . CheckFileHasAnyOfPermissions ( filePath , FileAccessPermissions . GroupWrite | FileAccessPermissions . OtherWrite ) )
111
- {
112
- var errorMessage = $ "Error due to other users having permission to modify the config file: { filePath } ";
113
- s_logger . Error ( errorMessage ) ;
114
- throw new Exception ( errorMessage ) ;
115
- }
116
- }
117
97
}
118
98
}
0 commit comments