protected BaseUserController(ULearnDb db) { this.db = db; userManager = new ULearnUserManager(db); usersRepo = new UsersRepo(db); metricSender = new GraphiteMetricSender("web"); secretForHashes = WebConfigurationManager.AppSettings["ulearn.secretForHashes"] ?? ""; var spamEndpoint = WebConfigurationManager.AppSettings["ulearn.spam.endpoint"] ?? ""; var spamLogin = WebConfigurationManager.AppSettings["ulearn.spam.login"] ?? "ulearn"; var spamPassword = WebConfigurationManager.AppSettings["ulearn.spam.password"] ?? ""; spamChannelId = WebConfigurationManager.AppSettings["ulearn.spam.channels.emailConfirmations"] ?? ""; spamTemplateId = WebConfigurationManager.AppSettings["ulearn.spam.templates.withButton"] ?? ""; try { spamClient = 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; } }
public NotificationSender(CourseManager courseManager, IEmailSender emailSender, ITelegramSender telegramSender, GraphiteMetricSender metricSender) { this.emailSender = emailSender; this.telegramSender = telegramSender; this.courseManager = courseManager; this.metricSender = metricSender; baseUrl = ConfigurationManager.AppSettings["ulearn.baseUrl"] ?? ""; secretForHashes = ConfigurationManager.AppSettings["ulearn.secretForHashes"] ?? ""; }
public QuizController() { metricSender = new GraphiteMetricSender("web"); userQuizzesRepo = new UserQuizzesRepo(db); visitsRepo = new VisitsRepo(db); groupsRepo = new GroupsRepo(db, courseManager); slideCheckingsRepo = new SlideCheckingsRepo(db); notificationsRepo = new NotificationsRepo(db); }
public static void PreStart() { if (!IsGraphiteSendingEnabled) { return; } // Make sure MetricsPipe handles BeginRequest and EndRequest DynamicModuleUtility.RegisterModule(typeof(MetricsPipeStartupModule)); MetricsPipeStartupModule.Settings.ReportRequestTime = true; MetricsPipeStartupModule.Settings.RequestTimePrefix = GraphiteMetricSender.BuildKey("web", "request.time"); }
public BaseExerciseController(ULearnDb db, CourseManager courseManager, GraphiteMetricSender metricSender) { this.db = db; this.courseManager = courseManager; this.metricSender = metricSender; userSolutionsRepo = new UserSolutionsRepo(db, courseManager); slideCheckingsRepo = new SlideCheckingsRepo(db); groupsRepo = new GroupsRepo(db, courseManager); visitsRepo = new VisitsRepo(db); notificationsRepo = new NotificationsRepo(db); usersRepo = new UsersRepo(db); styleErrorsRepo = new StyleErrorsRepo(db); }
public TelegramSender() { var botToken = ConfigurationManager.AppSettings["ulearn.telegram.botToken"]; try { bot = new TelegramBotClient(botToken); } catch (Exception e) { log.Error($"Can\'t initialize telegram bot with token \"{botToken.MaskAsSecret()}\"", e); throw; } log.Info($"Initialized telegram bot with token \"{botToken.MaskAsSecret()}\""); metricSender = new GraphiteMetricSender("notifications"); }
public RestorePasswordController(ULearnDb db) { this.db = db; userManager = new ULearnUserManager(db); requestRepo = new RestoreRequestRepo(db); metricSender = new GraphiteMetricSender("web"); var spamEndpoint = WebConfigurationManager.AppSettings["ulearn.spam.endpoint"] ?? ""; var spamLogin = WebConfigurationManager.AppSettings["ulearn.spam.login"] ?? "ulearn"; var spamPassword = WebConfigurationManager.AppSettings["ulearn.spam.password"] ?? ""; spamChannelId = WebConfigurationManager.AppSettings["ulearn.spam.channels.passwords"] ?? ""; try { spamClient = 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; } }
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 GraphiteMetricSender("notifications"); 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}'"); }