Created
September 13, 2023 00:42
-
-
Save xximjasonxx/060456a311c87919a21c57f7fa7290f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: FunctionsStartup(typeof(ConfigTest.Startup))] | |
namespace ConfigTest | |
{ | |
public class Startup : IWebJobsStartup | |
{ | |
public IConfiguration Configuration { get; set; } | |
public void Configure(IWebJobsBuilder builder) | |
{ | |
var configurationBuilder = new ConfigurationBuilder(); | |
configurationBuilder.AddEnvironmentVariables(); | |
var config = configurationBuilder.Build(); | |
configurationBuilder.AddAzureAppConfiguration(options => | |
{ | |
options.Connect(config["AppConfigConnectionString"]) | |
.ConfigureRefresh(refresh => | |
{ | |
refresh.Register("QueueName", refreshAll: true) | |
.SetCacheExpiration(TimeSpan.FromSeconds(5)); | |
}); | |
}); | |
Configuration = configurationBuilder.Build(); | |
builder.Services.Replace(ServiceDescriptor.Singleton(typeof(IConfiguration), Configuration)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment