Beispiel #1
0
 public static IServiceCollection AddAudit(this IServiceCollection services, StalkCitizenConfiguration configuration)
 {
     services.AddSingleton <IAudit>(new SerilogAzureEventHubsAuditClient(
                                        new SerilogAzureEventHubsAuditClientConfiguration
     {
         ConnectionString     = configuration.SerilogAzureEventHubConnectionString,
         EventSource          = configuration.SerilogAzureEventHubEventSource,
         EnrichFromLogContext = true,
     }));
     return(services);
 }
Beispiel #2
0
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", false, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddUserSecrets <Startup>(optional: false)
                          .AddEnvironmentVariables();

            Configuration = builder.Build().Get <StalkCitizenConfiguration>();
        }
Beispiel #3
0
 public static IServiceCollection AddCitizenNotifier(this IServiceCollection services, StalkCitizenConfiguration configuration)
 {
     services.AddScoped <ICitizenNotifier, MockCitizenNotifier>();
     return(services);
 }
Beispiel #4
0
 public static IServiceCollection AddSmsService(this IServiceCollection services, StalkCitizenConfiguration configuration)
 {
     services.AddSingleton <SmsOptions>(configuration.Sms);
     services.AddScoped <ISmsService, MockSmsService>();
     return(services);
 }