@@ -89,22 +89,29 @@ protected void SignalConfigChanged(string message = "")
8989 // Signal that a change has occurred to all change token listeners.
9090 RaiseChanged ( ) ;
9191
92- OnConfigChangedEvent ( new HotReloadEventArgs ( QUERY_MANAGER_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
93- OnConfigChangedEvent ( new HotReloadEventArgs ( METADATA_PROVIDER_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
94- OnConfigChangedEvent ( new HotReloadEventArgs ( QUERY_ENGINE_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
95- OnConfigChangedEvent ( new HotReloadEventArgs ( MUTATION_ENGINE_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
96- OnConfigChangedEvent ( new HotReloadEventArgs ( DOCUMENTOR_ON_CONFIG_CHANGED , message ) ) ;
97-
98- // Order of event firing matters: Authorization rules can only be updated after the
99- // MetadataProviderFactory has been updated with latest database object metadata.
100- // RuntimeConfig must already be updated and is implied to have been updated by the time
101- // this function is called.
102- OnConfigChangedEvent ( new HotReloadEventArgs ( AUTHZ_RESOLVER_ON_CONFIG_CHANGED , message ) ) ;
103-
104- // Order of event firing matters: Eviction must be done before creating a new schema and then updating the schema.
105- OnConfigChangedEvent ( new HotReloadEventArgs ( GRAPHQL_SCHEMA_EVICTION_ON_CONFIG_CHANGED , message ) ) ;
106- OnConfigChangedEvent ( new HotReloadEventArgs ( GRAPHQL_SCHEMA_CREATOR_ON_CONFIG_CHANGED , message ) ) ;
107- OnConfigChangedEvent ( new HotReloadEventArgs ( GRAPHQL_SCHEMA_REFRESH_ON_CONFIG_CHANGED , message ) ) ;
92+ // All the data inside of the if statement should only update when DAB is in development mode.
93+ if ( RuntimeConfig ! . IsDevelopmentMode ( ) )
94+ {
95+ OnConfigChangedEvent ( new HotReloadEventArgs ( QUERY_MANAGER_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
96+ OnConfigChangedEvent ( new HotReloadEventArgs ( METADATA_PROVIDER_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
97+ OnConfigChangedEvent ( new HotReloadEventArgs ( QUERY_ENGINE_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
98+ OnConfigChangedEvent ( new HotReloadEventArgs ( MUTATION_ENGINE_FACTORY_ON_CONFIG_CHANGED , message ) ) ;
99+ OnConfigChangedEvent ( new HotReloadEventArgs ( DOCUMENTOR_ON_CONFIG_CHANGED , message ) ) ;
100+
101+ // Order of event firing matters: Authorization rules can only be updated after the
102+ // MetadataProviderFactory has been updated with latest database object metadata.
103+ // RuntimeConfig must already be updated and is implied to have been updated by the time
104+ // this function is called.
105+ OnConfigChangedEvent ( new HotReloadEventArgs ( AUTHZ_RESOLVER_ON_CONFIG_CHANGED , message ) ) ;
106+
107+ // Order of event firing matters: Eviction must be done before creating a new schema and then updating the schema.
108+ OnConfigChangedEvent ( new HotReloadEventArgs ( GRAPHQL_SCHEMA_EVICTION_ON_CONFIG_CHANGED , message ) ) ;
109+ OnConfigChangedEvent ( new HotReloadEventArgs ( GRAPHQL_SCHEMA_CREATOR_ON_CONFIG_CHANGED , message ) ) ;
110+ OnConfigChangedEvent ( new HotReloadEventArgs ( GRAPHQL_SCHEMA_REFRESH_ON_CONFIG_CHANGED , message ) ) ;
111+ }
112+
113+ // Log Level Initializer is outside of if statement as it can be updated on both development and production mode.
114+ OnConfigChangedEvent ( new HotReloadEventArgs ( LOG_LEVEL_INITIALIZER_ON_CONFIG_CHANGE , message ) ) ;
108115 }
109116
110117 /// <summary>
@@ -388,4 +395,29 @@ public void RestoreLkgConfig()
388395 {
389396 RuntimeConfig = LastValidRuntimeConfig ;
390397 }
398+
399+ /// <summary>
400+ /// Uses the Last Valid Runtime Config and inserts the log-level property to the Runtime Config that will be used
401+ /// during the hot-reload if DAB is in Production Mode, this means that only changes to log-level will be registered.
402+ /// This is done in order to ensure that no unwanted changes are honored during hot-reload in Production Mode.
403+ /// </summary>
404+ public void InsertWantedChangesInProductionMode ( )
405+ {
406+ if ( ! RuntimeConfig ! . IsDevelopmentMode ( ) )
407+ {
408+ // Creates copy of last valid runtime config and only adds the new logger level changes
409+ RuntimeConfig runtimeConfigCopy = LastValidRuntimeConfig ! with
410+ {
411+ Runtime = LastValidRuntimeConfig . Runtime ! with
412+ {
413+ Telemetry = LastValidRuntimeConfig . Runtime ! . Telemetry ! with
414+ {
415+ LoggerLevel = RuntimeConfig . Runtime ! . Telemetry ! . LoggerLevel
416+ }
417+ }
418+ } ;
419+
420+ RuntimeConfig = runtimeConfigCopy ;
421+ }
422+ }
391423}
0 commit comments