Skip to content

Commit

Permalink
Added function for loading api configs
Browse files Browse the repository at this point in the history
  • Loading branch information
cubicgraphics committed May 11, 2024
1 parent e24f7c2 commit 8dec8da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BeatTogether.Status.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BeatTogether.Extensions.Serilog" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.18" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.29" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
)
.UseSerilog();
}

public static class HostBuilderExtensions
{
public static IHostBuilder UseStatusServer(this IHostBuilder hostBuilder) =>
hostBuilder
.ConfigureAppConfiguration()
.ConfigureServices((hostBuilderContext, services) =>
services
.Configure<StatusConfiguration>(hostBuilderContext.Configuration.GetSection("Status"))
.Configure<QuickplayConfiguration>(hostBuilderContext.Configuration.GetSection("Quickplay"))
);
}
}

0 comments on commit 8dec8da

Please sign in to comment.