예제 #1
0
 public GCloudContentScanTaskService(IOptionsMonitor <GoogleTasksConfiguration> optionsMonitor, CloudTasksClient cloudTasksClient,
                                     IOptionsMonitor <ServerConfiguration> serverConfigurationOptionsMonitor)
 {
     this.googleTasksConfiguration = optionsMonitor.CurrentValue;
     this.cloudTasksClient         = cloudTasksClient;
     this.serverConfiguration      = serverConfigurationOptionsMonitor.CurrentValue;
 }
예제 #2
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());
        }