public MailService(IMailChimpManager mailChimpManager, ILogger <MailService> logger, MailChimpConfig mailChimpConfig, MailConfig mailConfig) { _mailChimpManager = mailChimpManager; _logger = logger; _mailChimpConfig = mailChimpConfig; _mailConfig = mailConfig; }
public MailController(IMailChimpManager mailChimpManager, IMailService mailService, IContentService contentService, IViewRenderer viewRenderer, IBankHolidayService bankHolidayService, ILogger <MailController> logger, MailConfig mailConfig, MailChimpConfig mailChimpConfig) { _mailChimpManager = mailChimpManager; _mailService = mailService; _contentService = contentService; _viewRenderer = viewRenderer; _logger = logger; _mailConfig = mailConfig; _mailChimpConfig = mailChimpConfig; _bankHolidayService = bankHolidayService; }
public SendEmail(IOptions <EmailConfigList> emailConfigList, IOptions <MailChimpConfig> mailChimpConfig, string categroy) { if (categroy == EnumUtils.Category.ExchangeUnion.ToString()) { _emailConfig = emailConfigList.Value.XUCEmailConfig; } else if (categroy == EnumUtils.Category.DigitalFinanceGroup.ToString()) { _emailConfig = emailConfigList.Value.DFGEmailConfig; } _categroy = categroy; _mailChimpConfig = mailChimpConfig.Value; }
public MailChimpConfig() { Current = this; }
// This method gets called by the runtime. Use this method to add services to the container public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); services.AddLogging(builder => { builder.AddILoggingBuilderInstance(); }); services.TryAddSingleton <ISeriLogger, SeriLogger>(); services.TryAddSingleton <IStaticWebsiteService, S3StaticWebsiteService>(); services.TryAddSingleton <IViewRenderer, ViewRenderer>(); services.TryAddTransient <IMailService, MailService>(); services.TryAddTransient <IContentService, ContentService>(); services.TryAddTransient <IBankHolidayService, BankHolidayService>(); EnvironmentConfig environmentConfig = new EnvironmentConfig(); AWSConfig awsConfig = new AWSConfig(); CloudFrontConfig cloudFrontConfig = new CloudFrontConfig(); CMSConfig cmsConfig = new CMSConfig(); MailChimpConfig mailChimpConfig = new MailChimpConfig(); MailConfig mailConfig = new MailConfig(); Configuration.Bind("AppSettings:Environment", environmentConfig); Configuration.Bind("AWS", awsConfig); Configuration.Bind("AWS:CloudFront", cloudFrontConfig); Configuration.Bind("CMS", cmsConfig); Configuration.Bind("MailChimp", mailChimpConfig); Configuration.Bind("Mail", mailConfig); services.AddSingleton(environmentConfig) .AddSingleton(awsConfig) .AddSingleton(cloudFrontConfig) .AddSingleton(cmsConfig) .AddSingleton(mailChimpConfig) .AddSingleton(mailConfig); services.AddMailChimpClient(mailChimpConfig.ApiKey); AmazonS3Config s3config; if (environmentConfig.Name == "local") //TODO: Should use Environment.IsDevelopment() here. When running tests it returns "Production" { s3config = new AmazonS3Config() { RegionEndpoint = Region, ServiceURL = awsConfig.ServiceURL, ForcePathStyle = true }; } else { s3config = new AmazonS3Config() { RegionEndpoint = Region }; } services.AddTransient <IAmazonS3>((sP) => { return(new AmazonS3Client(awsConfig.AccessKey, awsConfig.SecretKey, s3config)); }); var cloudfrontConfig = new AmazonCloudFrontConfig() { RegionEndpoint = Region }; services.AddTransient <IAmazonCloudFront>((acf) => { return(new AmazonCloudFrontClient(awsConfig.AccessKey, awsConfig.SecretKey, cloudfrontConfig)); }); services.AddControllers(); }