public Harvester(HarvesterCommonOptions options) { // Note: If the same machine runs multiple BloomHarvester processes, then you need to add a suffix to this. this.Identifier = Environment.MachineName; if (options.SuppressLogs) { _logger = new ConsoleLogger(); } else { EnvironmentSetting azureMonitorEnvironment = EnvironmentUtils.GetEnvOrFallback(options.LogEnvironment, options.Environment); _logger = new AzureMonitorLogger(azureMonitorEnvironment, this.Identifier); } EnvironmentSetting parseDBEnvironment = EnvironmentUtils.GetEnvOrFallback(options.ParseDBEnvironment, options.Environment); _parseClient = new ParseClient(parseDBEnvironment); _parseClient.Logger = _logger; string downloadBucketName; string uploadBucketName; switch (parseDBEnvironment) { case EnvironmentSetting.Prod: downloadBucketName = BloomS3Client.ProductionBucketName; uploadBucketName = HarvesterS3Client.HarvesterProductionBucketName; break; case EnvironmentSetting.Test: downloadBucketName = BloomS3Client.UnitTestBucketName; uploadBucketName = HarvesterS3Client.HarvesterUnitTestBucketName; break; case EnvironmentSetting.Dev: case EnvironmentSetting.Local: default: downloadBucketName = BloomS3Client.SandboxBucketName; uploadBucketName = HarvesterS3Client.HarvesterSandboxBucketName; break; } _transfer = new BookTransfer(_parseClient, bloomS3Client: new HarvesterS3Client(downloadBucketName), htmlThumbnailer: null, bookDownloadStartingEvent: new BookDownloadStartingEvent()); _s3UploadClient = new HarvesterS3Client(uploadBucketName); }
public Harvester(HarvesterCommonOptions options) { this.Identifier = Environment.MachineName; if (options.SuppressLogs) { _logger = new ConsoleLogger(); } else { EnvironmentSetting azureMonitorEnvironment = EnvironmentUtils.GetEnvOrFallback(options.LogEnvironment, options.Environment); _logger = new AzureMonitorLogger(azureMonitorEnvironment, this.Identifier); } EnvironmentSetting parseDBEnvironment = EnvironmentUtils.GetEnvOrFallback(options.ParseDBEnvironment, options.Environment); _parseClient = new ParseClient(parseDBEnvironment); _parseClient.Logger = _logger; }