public ImageService(IHttpClientFactory httpClientFactory, IOptionsMonitor <ImageServiceConfiguration> optionsMonitor, IOptionsMonitor <ServerConfiguration> serverConfigurationServiceMonitor) { httpClient = httpClientFactory.CreateClient(Constants.IMAGES_MICROSERVICE_HTTP_CLIENT_NAME); imageServiceConfiguration = optionsMonitor.CurrentValue; serverConfiguration = serverConfigurationServiceMonitor.CurrentValue; }
public static void OnInit(ClientErrorManager manager, ImageServiceConfiguration configuration) { manager.AddErrors(new ClientErrors("ImageService", new Dictionary <string, ClientError> { { "inc-photo-type", new ClientError("Incorrect photo type!") }, { "image-load-err", new ClientError("Image loading error!") }, { "too-big-image", new ClientError($"Too big image > {configuration.MaxSizeByte} byte") }, })); }
public ImageService(IGenericRepository <Image> imageGR, IMapper mapper, ImageServiceConfiguration configuration, IFileService fileService) { _imageGR = imageGR; _configuration = configuration; _fileService = fileService; }
public static void AddGCloudServices(this IServiceCollection services, GoogleTasksConfiguration configuration, ImageServiceConfiguration imageServiceConfiguration) { Environment.SetEnvironmentVariable(configuration.KeyEnvironmentVariableName, configuration.KeyPath); CloudTasksClientBuilder cloudTasksClientBuilder = new CloudTasksClientBuilder { CredentialsPath = configuration.KeyPath }; services.AddHttpClient(Constants.IMAGES_MICROSERVICE_HTTP_CLIENT_NAME, client => { client.BaseAddress = new Uri(imageServiceConfiguration.Url); }); services.AddScoped(s => cloudTasksClientBuilder.Build()); }
public static void UseImageService(this IServiceCollection services, ImageServiceConfiguration configuration) { services.AddSingleton(configuration); services.AddScoped <IImageService, ImageService>(); }
public ImageServiceConfiguration UpdateImageServiceConfiguration(ImageServiceConfiguration imageServiceConfiguration) { throw new NotImplementedException(); }