mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-02-16 10:58:32 -05:00
Add power database support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using ChrisKaczor.HomeMonitor.Power.Service.Data;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.ResponseCompression;
|
||||
@@ -12,6 +13,8 @@ namespace ChrisKaczor.HomeMonitor.Power.Service
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<Database>();
|
||||
|
||||
services.AddHostedService<PowerReader>();
|
||||
|
||||
services.Configure<GzipCompressionProviderOptions>(options =>
|
||||
@@ -35,6 +38,9 @@ namespace ChrisKaczor.HomeMonitor.Power.Service
|
||||
if (environment.IsDevelopment())
|
||||
applicationBuilder.UseDeveloperExceptionPage();
|
||||
|
||||
var database = applicationBuilder.ApplicationServices.GetService<Database>();
|
||||
database.EnsureDatabase();
|
||||
|
||||
applicationBuilder.UseCors("CorsPolicy");
|
||||
|
||||
applicationBuilder.UseResponseCompression();
|
||||
|
||||
Reference in New Issue
Block a user