public CustomHost() { _host = new HostBuilder() .ConfigureHostConfiguration(configHost => { configHost.SetBasePath(Directory.GetCurrentDirectory()); configHost.AddJsonFile("hostsettings.json", optional: true); configHost.AddEnvironmentVariables(prefix: "PREFIX_"); }) .ConfigureAppConfiguration((hostContext, config) => { config.AddEnvironmentVariables(); config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); config.AddJsonFile( $"appsettings.{hostContext.HostingEnvironment.EnvironmentName}.json", optional: true); }) .ConfigureServices((hostContext, services) => { var config = new SfConfig(); hostContext.Configuration.Bind("Salesforce", config); services.AddSingleton(config); services.AddHostedService <HttpServer>(); }) .UseConsoleLifetime() .Build(); }
public HttpServer( HostBuilderOptions hostOptions, SfConfig config, IApplicationLifetime applicationLifetime) { _hostOptions = hostOptions; _config = config; _applicationLifetime = applicationLifetime; }
public HttpServer(SfConfig config) { _config = config; }