Unleash client init
This commit is contained in:
parent
d33a19d35f
commit
355b2d4c7c
4 changed files with 63 additions and 28 deletions
|
|
@ -8,34 +8,35 @@ using System.Linq;
|
|||
using isn.ViewModels;
|
||||
using Unleash.ClientFactory;
|
||||
using Unleash;
|
||||
using isnd.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using isnd.Helpers;
|
||||
|
||||
namespace isn.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
readonly IHostingEnvironment _environment;
|
||||
public SmtpSettings _smtpSettings { get; } //set only via Secret Manager
|
||||
|
||||
private ApplicationDbContext _dbContext;
|
||||
private readonly ApplicationDbContext _dbContext;
|
||||
private readonly IUnleash _unleashĈlient;
|
||||
|
||||
public HomeController(
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IHostingEnvironment environment,
|
||||
ApplicationDbContext dbContext,
|
||||
IOptions<UnleashClientSettings> unleashClientSettings,
|
||||
IHostingEnvironment env,
|
||||
ILogger<HomeController> logger)
|
||||
{
|
||||
_environment = environment;
|
||||
_logger = logger;
|
||||
_smtpSettings = smtpSettings.Value;
|
||||
_dbContext = dbContext;
|
||||
_unleashĈlient = env.CreateUnleahClient(unleashClientSettings.Value);
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View(new HomeIndexViewModel{
|
||||
PkgCount = _dbContext.Packages.Count(),
|
||||
UnleashClient = Startup.UnleashĈlient
|
||||
UnleashClient = _unleashĈlient
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue