-
Notifications
You must be signed in to change notification settings - Fork 0
/
Startup.cs
40 lines (35 loc) · 1.48 KB
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Moodful.Configuration;
[assembly: FunctionsStartup(typeof(Moodful.Startup))]
namespace Moodful
{
/// <summary>
/// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/startup?view=aspnetcore-5.0
/// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-5.0
/// https://github.com/Azure/azure-functions-host/issues/4464#issuecomment-521869759
/// </summary>
public class Startup : FunctionsStartup
{
public Startup()
{
}
public override void Configure(IFunctionsHostBuilder builder)
{
var context = builder.GetContext();
var authenticationOptions = context.Configuration.GetSection(nameof(AuthenticationOptions));
builder.Services.Configure<AuthenticationOptions>(authenticationOptions);
}
public override void ConfigureAppConfiguration(IFunctionsConfigurationBuilder builder)
{
var context = builder.GetContext();
builder.ConfigurationBuilder
.SetBasePath(context.ApplicationRootPath)
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{context.EnvironmentName}.json", optional: true)
.AddJsonFile("local.settings.json", optional: true)
.Build();
}
}
}