Unify picture configuration and options registration
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Musify.Application.Configuration;
|
||||
|
||||
namespace Musify.Api.Authentication;
|
||||
|
||||
public sealed class AuthenticationConfiguration
|
||||
public sealed class AuthenticationConfiguration : IConfigurationOptions
|
||||
{
|
||||
public const string SectionName = "Authentication";
|
||||
public static string SectionName => "Authentication";
|
||||
|
||||
[Required]
|
||||
[Url]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Musify.Application.Configuration;
|
||||
|
||||
namespace Musify.Api.Authentication;
|
||||
|
||||
@@ -9,13 +9,7 @@ public static class AuthenticationExtensions
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
services
|
||||
.AddOptionsWithValidateOnStart<AuthenticationConfiguration>()
|
||||
.Bind(configuration.GetRequiredSection(AuthenticationConfiguration.SectionName))
|
||||
.ValidateDataAnnotations();
|
||||
|
||||
services.AddSingleton(serviceProvider =>
|
||||
serviceProvider.GetRequiredService<IOptions<AuthenticationConfiguration>>().Value);
|
||||
services.AddValidatedOptions<AuthenticationConfiguration>(configuration);
|
||||
|
||||
services.AddMemoryCache();
|
||||
services.AddHttpClient();
|
||||
|
||||
@@ -59,37 +59,37 @@
|
||||
"PlayList": {
|
||||
"Routes": {
|
||||
"UploadsFolder": "uploads",
|
||||
"ParentFolders": "PlayLists",
|
||||
"ParentFolder": "PlayLists",
|
||||
"OriginalPicturesFolder": "OriginalPictures",
|
||||
"SmallPicturesFolder": "SmallPictures",
|
||||
"MediumPicturesFolder": "MediumPictures",
|
||||
"LargePicturesFolder": "LargePictures"
|
||||
},
|
||||
"PicturesSizes": {
|
||||
"SmallPictureWidth": 128,
|
||||
"SmallPictureHeight": 128,
|
||||
"MediumPictureWidth": 256,
|
||||
"MediumPictureHeight": 256,
|
||||
"LargePictureWidth": 512,
|
||||
"LargePictureHeight": 512
|
||||
"SmallWidth": 128,
|
||||
"SmallHeight": 128,
|
||||
"MediumWidth": 256,
|
||||
"MediumHeight": 256,
|
||||
"LargeWidth": 512,
|
||||
"LargeHeight": 512
|
||||
}
|
||||
},
|
||||
"Album": {
|
||||
"Routes": {
|
||||
"UploadsFolder": "uploads",
|
||||
"ParentFolders": "Albums",
|
||||
"ParentFolder": "Albums",
|
||||
"OriginalPicturesFolder": "OriginalPictures",
|
||||
"SmallPicturesFolder": "SmallPictures",
|
||||
"MediumPicturesFolder": "MediumPictures",
|
||||
"LargePicturesFolder": "LargePictures"
|
||||
},
|
||||
"PicturesSizes": {
|
||||
"SmallPictureWidth": 128,
|
||||
"SmallPictureHeight": 128,
|
||||
"MediumPictureWidth": 256,
|
||||
"MediumPictureHeight": 256,
|
||||
"LargePictureWidth": 512,
|
||||
"LargePictureHeight": 512
|
||||
"SmallWidth": 128,
|
||||
"SmallHeight": 128,
|
||||
"MediumWidth": 256,
|
||||
"MediumHeight": 256,
|
||||
"LargeWidth": 512,
|
||||
"LargeHeight": 512
|
||||
}
|
||||
},
|
||||
"Track": {
|
||||
@@ -105,15 +105,15 @@
|
||||
"PresetMediumPicture": "PresetMediumPicture.webp",
|
||||
"PresetLargePicture": "PresetLargePicture.webp",
|
||||
"OriginalAudiosFolder": "OriginalAudios",
|
||||
"ProcessedAudioFolder": "ProcessedAudios"
|
||||
"ProcessedAudiosFolder": "ProcessedAudios"
|
||||
},
|
||||
"PicturesSizes": {
|
||||
"SmallPictureWidth": 128,
|
||||
"SmallPictureHeight": 128,
|
||||
"MediumPictureWidth": 256,
|
||||
"MediumPictureHeight": 256,
|
||||
"LargePictureWidth": 512,
|
||||
"LargePictureHeight": 512
|
||||
"SmallWidth": 128,
|
||||
"SmallHeight": 128,
|
||||
"MediumWidth": 256,
|
||||
"MediumHeight": 256,
|
||||
"LargeWidth": 512,
|
||||
"LargeHeight": 512
|
||||
}
|
||||
},
|
||||
"UploadIntent": {
|
||||
|
||||
Reference in New Issue
Block a user