@@ -11,7 +11,7 @@ namespace StackifyLib
11
11
/// </summary>
12
12
public class Config
13
13
{
14
- #if NETCORE || NETCOREX
14
+ #if NETCORE || NETCOREX
15
15
16
16
private static Microsoft . Extensions . Configuration . IConfigurationRoot _configuration = null ;
17
17
@@ -20,7 +20,7 @@ public static void SetConfiguration(Microsoft.Extensions.Configuration.IConfigur
20
20
_configuration = configuration ;
21
21
}
22
22
23
- #endif
23
+ #endif
24
24
25
25
static Config ( )
26
26
{
@@ -31,21 +31,21 @@ public static void LoadSettings()
31
31
{
32
32
try
33
33
{
34
- CaptureErrorPostdata = Get ( "Stackify.CaptureErrorPostdata" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
34
+ CaptureErrorPostdata = Get ( "Stackify.CaptureErrorPostdata" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
35
35
36
- CaptureServerVariables = Get ( "Stackify.CaptureServerVariables" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
36
+ CaptureServerVariables = Get ( "Stackify.CaptureServerVariables" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
37
37
38
- CaptureSessionVariables = Get ( "Stackify.CaptureSessionVariables" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
38
+ CaptureSessionVariables = Get ( "Stackify.CaptureSessionVariables" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
39
39
40
40
CaptureErrorHeaders = Get ( "Stackify.CaptureErrorHeaders" , bool . TrueString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
41
41
42
- CaptureErrorCookies = Get ( "Stackify.CaptureErrorCookies" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
42
+ CaptureErrorCookies = Get ( "Stackify.CaptureErrorCookies" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
43
43
44
- ApiKey = Get ( "Stackify.ApiKey" , string . Empty ) ;
44
+ ApiKey = Get ( "Stackify.ApiKey" , ApiKey ?? string . Empty ) ;
45
45
46
- AppName = Get ( "Stackify.AppName" , string . Empty ) ;
46
+ AppName = Get ( "Stackify.AppName" , AppName ?? string . Empty ) ;
47
47
48
- Environment = Get ( "Stackify.Environment" , string . Empty ) ;
48
+ Environment = Get ( "Stackify.Environment" , Environment ?? string . Empty ) ;
49
49
50
50
CaptureErrorHeadersWhitelist = Get ( "Stackify.CaptureErrorHeadersWhitelist" , string . Empty ) ;
51
51
@@ -154,21 +154,21 @@ internal static string Get(string key, string defaultValue = null)
154
154
155
155
try
156
156
{
157
- if ( key != null )
157
+ if ( string . IsNullOrWhiteSpace ( key ) == false )
158
158
{
159
159
#if NETCORE || NETCOREX
160
160
if ( _configuration != null )
161
161
{
162
162
var appSettings = _configuration . GetSection ( "Stackify" ) ;
163
- v = appSettings [ key . Replace ( "Stackify." , "" ) ] ;
163
+ v = appSettings [ key . Replace ( "Stackify." , string . Empty ) ] ;
164
164
}
165
165
#endif
166
166
167
167
#if NETCOREX
168
168
if ( _configuration != null )
169
169
{
170
170
var appSettings = _configuration . GetSection ( "Stackify" ) ;
171
- v = appSettings [ key . Replace ( "Stackify." , "" ) ] ;
171
+ v = appSettings [ key . Replace ( "Stackify." , string . Empty ) ] ;
172
172
}
173
173
#endif
174
174
0 commit comments