Upload patchfiles to azure blobstore
This commit is contained in:
@@ -2,9 +2,13 @@
|
||||
{
|
||||
using System.Text.Json.Serialization;
|
||||
using ALttPRandomizer.Options;
|
||||
using Azure.Identity;
|
||||
using Azure.Storage.Blobs;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
@@ -19,10 +23,19 @@
|
||||
|
||||
builder.Services.Configure<ServiceOptions>(builder.Configuration.GetSection("ALttPRandomizer"));
|
||||
|
||||
builder.Services.AddLogging(lb => lb.AddConsole());
|
||||
|
||||
builder.Services.AddControllers().AddJsonOptions(x =>
|
||||
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var provider = builder.Services.BuildServiceProvider();
|
||||
var settings = provider.GetRequiredService<IOptionsMonitor<ServiceOptions>>().CurrentValue!;
|
||||
|
||||
var token = new DefaultAzureCredential();
|
||||
var seedClient = new BlobContainerClient(settings.AzureSettings.BlobstoreEndpoint, token);
|
||||
|
||||
builder.Services.AddSingleton(seedClient);
|
||||
builder.Services.AddScoped<Randomizer, Randomizer>();
|
||||
builder.Services.AddScoped<IdGenerator, IdGenerator>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user