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;
 }
示例#2
0
 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") },
     }));
 }
示例#3
0
 public ImageService(IGenericRepository <Image> imageGR,
                     IMapper mapper,
                     ImageServiceConfiguration configuration,
                     IFileService fileService)
 {
     _imageGR       = imageGR;
     _configuration = configuration;
     _fileService   = fileService;
 }
示例#4
0
        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());
        }
示例#5
0
 public static void UseImageService(this IServiceCollection services, ImageServiceConfiguration configuration)
 {
     services.AddSingleton(configuration);
     services.AddScoped <IImageService, ImageService>();
 }
示例#6
0
 public ImageServiceConfiguration UpdateImageServiceConfiguration(ImageServiceConfiguration imageServiceConfiguration)
 {
     throw new NotImplementedException();
 }