as is
This commit is contained in:
@@ -5,17 +5,22 @@ namespace StopShopping.Services.Extensions;
|
||||
/// </summary>
|
||||
public record AppOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件服务站点
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string FileApiDomain { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 文件服务本地站点
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string FileApiLocalDomain { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// .bjbj.me
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string CookieDomain { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 域名,http(s)://www.xxx.xx
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string DomainPath { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// anti-forgery 请求头
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using FileSignatures;
|
||||
using FileSignatures.Formats;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StopShopping.EF;
|
||||
using StopShopping.Services;
|
||||
using StopShopping.Services.Extensions;
|
||||
@@ -21,16 +20,18 @@ public static class ServicesExtensions
|
||||
|
||||
services.Configure<AppOptions>(appOptions);
|
||||
|
||||
var imageFormats = FileFormatLocator.GetFormats().OfType<Image>();
|
||||
var imageInspector = new FileFormatInspector(imageFormats);
|
||||
services.AddSingleton<IFileFormatInspector>(imageInspector);
|
||||
services.AddHttpClient(Consts.FILE_API_CLIENT_NAME, (sp, client) =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<AppOptions>>();
|
||||
client.BaseAddress = new Uri(options.Value.FileApiLocalDomain);
|
||||
});
|
||||
|
||||
services.AddSingleton<ICipherService, CipherService>();
|
||||
services.AddSingleton<ISerialNoGenerator, NanoidSerialNoGenerator>();
|
||||
|
||||
services.AddScoped<IFileService, FileService>();
|
||||
services.AddScoped<IDistrictService, DistrictService>();
|
||||
services.AddScoped<IClaimsService, ClaimsService>();
|
||||
services.AddScoped<IFileService, FileService>();
|
||||
services.AddScoped<IAccessTokenService, AccessTokenService>();
|
||||
services.AddScoped<IUserService, UserService>();
|
||||
services.AddScoped<ICategoryService, CategoryService>();
|
||||
|
||||
Reference in New Issue
Block a user