public KonturSpamEmailSender(MetricSender metricSender, IOptions <NotificationsConfiguration> options) { this.metricSender = metricSender; var config = options.Value; var spamEndpoint = config.Spam.Endpoint ?? ""; var spamLogin = config.Spam.Login ?? "ulearn"; var spamPassword = config.Spam.Password ?? ""; channelId = config.Spam.Channels.Notifications ?? ""; templateId = config.Spam.Templates.WithButton; try { client = new SpamClient(new Uri(spamEndpoint), spamLogin, spamPassword); } catch (Exception e) { log.Error(e, $"Can\'t initialize Spam.API client to {spamEndpoint}, login {spamLogin}, password {spamPassword.MaskAsSecret()}"); throw; } log.Info($"Initialized Spam.API client to {spamEndpoint}, login {spamLogin}, password {spamPassword.MaskAsSecret()}"); log.Info($"Using channel '{channelId}'"); }
public HomeController( IHtmlLocalizer <HomeController> htmlLocalizer, IStringLocalizer <HomeController> stringLocalizer, ISpamSettingsStore <SpamSettings> spamSettingsStore, IAuthorizationService authorizationService, IEntityReplyStore <DocComment> entityReplyStore, IPlatoUserStore <User> platoUserStore, IOptions <PlatoOptions> platoOpts, IEntityStore <Doc> entityStore, IContextFacade contextFacade, ISpamChecker spamChecker, ISpamClient spamClient, IAlerter alerter) { _authorizationService = authorizationService; _spamSettingsStore = spamSettingsStore; _entityReplyStore = entityReplyStore; _platoUserStore = platoUserStore; _contextFacade = contextFacade; _platoOpts = platoOpts.Value; _spamChecker = spamChecker; _entityStore = entityStore; _spamClient = spamClient; _alerter = alerter; T = htmlLocalizer; S = stringLocalizer; }
public KonturSpamEmailSender() { var spamEndpoint = ConfigurationManager.AppSettings["ulearn.spam.endpoint"] ?? ""; var spamLogin = ConfigurationManager.AppSettings["ulearn.spam.login"] ?? "ulearn"; var spamPassword = ConfigurationManager.AppSettings["ulearn.spam.password"] ?? ""; channelId = ConfigurationManager.AppSettings["ulearn.spam.channels.notifications"] ?? ""; templateId = ConfigurationManager.AppSettings["ulearn.spam.templates.withButton"]; metricSender = new MetricSender(ApplicationConfiguration.Read <UlearnConfiguration>().GraphiteServiceName); try { client = new SpamClient(new Uri(spamEndpoint), spamLogin, spamPassword); } catch (Exception e) { log.Error($"Can\'t initialize Spam.API client to {spamEndpoint}, login {spamLogin}, password {spamPassword.MaskAsSecret()}", e); throw; } log.Info($"Initialized Spam.API client to {spamEndpoint}, login {spamLogin}, password {spamPassword.MaskAsSecret()}"); log.Info($"Using channel '{channelId}'"); }
public SpamProxy( ISpamClient spamClient) { _spamClient = spamClient; }