@@ -36,6 +36,10 @@ public static void LoadSettings()
3636 {
3737 try
3838 {
39+ if ( IsStackifyJsonLoaded == false ) {
40+ ReadStackifyJSONConfig ( ) ; // TODO: Better way?
41+ }
42+
3943 CaptureServerVariables = Get ( "Stackify.CaptureServerVariables" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
4044
4145 CaptureSessionVariables = Get ( "Stackify.CaptureSessionVariables" , bool . FalseString ) . Equals ( bool . TrueString , StringComparison . CurrentCultureIgnoreCase ) ;
@@ -155,6 +159,8 @@ public static void LoadSettings()
155159
156160 public static int LoggingJsonMaxFields { get ; set ; } = 50 ;
157161
162+ public static bool ? IsStackifyJsonLoaded { get ; set ; } = false ;
163+
158164
159165 /// <summary>
160166 /// Attempts to fetch a setting value given the key.
@@ -221,16 +227,13 @@ public static void ReadStackifyJSONConfig()
221227
222228 if ( File . Exists ( jsonPath ) )
223229 {
224- StackifyAPILogger . Log ( $ "#jsonPath exists: { jsonPath } ") ;
225-
226230 using ( var fs = new FileStream ( jsonPath , FileMode . Open , FileAccess . Read , FileShare . ReadWrite ) )
227231 {
228232 using ( var sr = new StreamReader ( fs ) )
229233 {
230234 json = sr . ReadToEnd ( ) ;
231235 }
232236 }
233-
234237 var obj = JObject . Parse ( json , Settings ) ;
235238 Config . SetStackifyObj ( obj ) ;
236239 }
@@ -242,7 +245,6 @@ public static void ReadStackifyJSONConfig()
242245
243246 if ( File . Exists ( iisJsonPath ) )
244247 {
245- StackifyAPILogger . Log ( $ "#iisJsonPath exists: { iisJsonPath } ") ;
246248 using ( var fs = new FileStream ( iisJsonPath , FileMode . Open , FileAccess . Read , FileShare . ReadWrite ) )
247249 {
248250 using ( var sr = new StreamReader ( fs ) )
@@ -261,7 +263,7 @@ public static void ReadStackifyJSONConfig()
261263 {
262264 StackifyAPILogger . Log ( "#Config #ReadStackifyJSONConfig failed" , ex ) ;
263265 }
264-
266+ IsStackifyJsonLoaded = true ;
265267 }
266268
267269#if JSONTEST
0 commit comments