Example #1
0
        public Startup(IHostingEnvironment env)
        {
            _billRepository            = new BillRepository();
            _shoppingRepository        = new ShoppingRepository();
            _peopleRepository          = new PeopleRepository();
            _toDoRepository            = new ToDoRepository();
            _householdRepository       = new HouseholdRepository();
            _discordService            = new DiscordService(new HttpClient());
            _userService               = new UserService(new UserCache(), _peopleRepository);
            _inviteLinkService         = new InviteLinkService();
            _googleTokenAuthentication = new GoogleTokenAuthentication(new HttpClient());
            _recurringBillWorker       = new RecurringBillWorker(_billRepository);

            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            if (env.IsDevelopment())
            {
                builder.AddApplicationInsightsSettings(developerMode: true);
            }

            var discordWorker           = new DiscordMessageListener(_billRepository, _shoppingRepository, _peopleRepository, _discordService);
            var backgroundDiscordWorker = new Task(() => discordWorker.StartWorker());

            backgroundDiscordWorker.Start();

            Configuration = builder.Build();
        }
Example #2
0
 public UserController(IPeopleRepository peopleRepository, IUserService userService, IGoogleTokenAuthentication googleTokenAuthentication)
 {
     _userService = userService;
     _googleTokenAuthentication = googleTokenAuthentication;
     _peopleRepository          = peopleRepository;
 }