public AcmeHostedService(ILogger <AcmeHostedService> logger, IServiceProvider services, AcmeOptions options, AcmeState state) { _logger = logger; _services = services; _options = options; _state = state; }
public static IWebHostBuilder AddAcmeServices(this IWebHostBuilder builder, AcmeOptions acmeOptions) { builder.ConfigureServices(services => { services.AddSingleton <AcmeOptions>(acmeOptions); services.AddSingleton(AcmeState.Instance); services.AddHostedService <AcmeHostedService>(); }); builder.UseKestrel((context, options) => options.ConfigureHttpsDefaults(configOpts => { configOpts.ServerCertificateSelector = (cc, x) => { return(AcmeState.Instance.Certificate); }; })); return(builder); }
public static IWebHostBuilder AddAcmeServices(this IWebHostBuilder builder, IEnumerable <string> dnsNames, IEnumerable <string> contactEmails = null, bool acceptTos = false, string rootDir = null) { var acmeOptions = new AcmeOptions { AccountContactEmails = contactEmails, AcceptTermsOfService = acceptTos, DnsNames = dnsNames, }; if (rootDir != null) { acmeOptions.AcmeRootDir = rootDir; } return(AddAcmeServices(builder, acmeOptions)); }