1010using Microsoft . AspNetCore . Http ;
1111using Microsoft . Azure . WebJobs . Logging ;
1212using Microsoft . Azure . WebJobs . Script . Extensions ;
13+ using Microsoft . Extensions . Configuration ;
1314using Microsoft . Extensions . FileProviders ;
1415using Microsoft . Extensions . Logging ;
1516using Microsoft . Extensions . Options ;
@@ -25,17 +26,20 @@ public class StandbyManager : IStandbyManager
2526 private readonly IScriptHostManager _scriptHostManager ;
2627 private readonly IOptionsMonitor < ScriptApplicationHostOptions > _options ;
2728 private readonly Lazy < Task > _specializationTask ;
29+ private readonly IConfigurationRoot _configuration ;
2830 private readonly ILogger _logger ;
2931 private static CancellationTokenSource _standbyCancellationTokenSource = new CancellationTokenSource ( ) ;
3032 private static IChangeToken _standbyChangeToken = new CancellationChangeToken ( _standbyCancellationTokenSource . Token ) ;
3133 private static SemaphoreSlim _semaphore = new SemaphoreSlim ( 1 , 1 ) ;
3234
33- public StandbyManager ( IScriptHostManager scriptHostManager , IOptionsMonitor < ScriptApplicationHostOptions > options , ILoggerFactory loggerFactory )
35+ public StandbyManager ( IScriptHostManager scriptHostManager , IConfiguration configuration , IOptionsMonitor < ScriptApplicationHostOptions > options , ILoggerFactory loggerFactory )
3436 {
3537 _scriptHostManager = scriptHostManager ?? throw new ArgumentNullException ( nameof ( scriptHostManager ) ) ;
3638 _options = options ?? throw new ArgumentNullException ( nameof ( options ) ) ;
3739 _logger = loggerFactory . CreateLogger ( LogCategories . Startup ) ;
3840 _specializationTask = new Lazy < Task > ( SpecializeHostCoreAsync , LazyThreadSafetyMode . ExecutionAndPublication ) ;
41+
42+ _configuration = configuration as IConfigurationRoot ;
3943 }
4044
4145 public static IChangeToken ChangeToken => _standbyChangeToken ;
@@ -47,6 +51,9 @@ public Task SpecializeHostAsync()
4751
4852 public async Task SpecializeHostCoreAsync ( )
4953 {
54+ // Trigger a configuration reload to pick up all current settings
55+ _configuration ? . Reload ( ) ;
56+
5057 NotifyChange ( ) ;
5158
5259 await _scriptHostManager . RestartHostAsync ( ) ;
0 commit comments