@@ -11,7 +11,7 @@ namespace StackifyLib
1111 /// </summary>
1212 public class Config
1313 {
14- #if NETCORE || NETCOREX
14+ #if NETCORE || NETCOREX
1515
1616 private static Microsoft . Extensions . Configuration . IConfigurationRoot _configuration = null ;
1717
@@ -20,7 +20,7 @@ public static void SetConfiguration(Microsoft.Extensions.Configuration.IConfigur
2020 _configuration = configuration ;
2121 }
2222
23- #endif
23+ #endif
2424
2525 static Config ( )
2626 {
@@ -31,21 +31,21 @@ public static void LoadSettings()
3131 {
3232 try
3333 {
34- CaptureErrorPostdata = Get ( "Stackify.CaptureErrorPostdata" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
34+ CaptureErrorPostdata = Get ( "Stackify.CaptureErrorPostdata" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
3535
36- CaptureServerVariables = Get ( "Stackify.CaptureServerVariables" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
36+ CaptureServerVariables = Get ( "Stackify.CaptureServerVariables" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
3737
38- CaptureSessionVariables = Get ( "Stackify.CaptureSessionVariables" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
38+ CaptureSessionVariables = Get ( "Stackify.CaptureSessionVariables" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
3939
4040 CaptureErrorHeaders = Get ( "Stackify.CaptureErrorHeaders" , bool . TrueString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
4141
42- CaptureErrorCookies = Get ( "Stackify.CaptureErrorCookies" , string . Empty ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
42+ CaptureErrorCookies = Get ( "Stackify.CaptureErrorCookies" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
4343
44- ApiKey = Get ( "Stackify.ApiKey" , string . Empty ) ;
44+ ApiKey = Get ( "Stackify.ApiKey" , ApiKey ?? string . Empty ) ;
4545
46- AppName = Get ( "Stackify.AppName" , string . Empty ) ;
46+ AppName = Get ( "Stackify.AppName" , AppName ?? string . Empty ) ;
4747
48- Environment = Get ( "Stackify.Environment" , string . Empty ) ;
48+ Environment = Get ( "Stackify.Environment" , Environment ?? string . Empty ) ;
4949
5050 CaptureErrorHeadersWhitelist = Get ( "Stackify.CaptureErrorHeadersWhitelist" , string . Empty ) ;
5151
@@ -154,21 +154,21 @@ internal static string Get(string key, string defaultValue = null)
154154
155155 try
156156 {
157- if ( key != null )
157+ if ( string . IsNullOrWhiteSpace ( key ) == false )
158158 {
159159#if NETCORE || NETCOREX
160160 if ( _configuration != null )
161161 {
162162 var appSettings = _configuration . GetSection ( "Stackify" ) ;
163- v = appSettings [ key . Replace ( "Stackify." , "" ) ] ;
163+ v = appSettings [ key . Replace ( "Stackify." , string . Empty ) ] ;
164164 }
165165#endif
166166
167167#if NETCOREX
168168 if ( _configuration != null )
169169 {
170170 var appSettings = _configuration . GetSection ( "Stackify" ) ;
171- v = appSettings [ key . Replace ( "Stackify." , "" ) ] ;
171+ v = appSettings [ key . Replace ( "Stackify." , string . Empty ) ] ;
172172 }
173173#endif
174174
0 commit comments