-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
171 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"editorconfig.editorconfig", | ||
"ms-dotnettools.csharp" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: "3.9" | ||
--- | ||
services: | ||
unitynuget: | ||
build: ../.. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" /> | ||
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> | ||
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" /> | ||
<PackageVersion Include="NuGet.PackageManagement" Version="6.12.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" /> | ||
<PackageVersion Include="NUglify" Version="1.21.10" /> | ||
<PackageVersion Include="nunit" Version="4.2.2" /> | ||
<PackageVersion Include="NUnit.Analyzers" Version="4.4.0" /> | ||
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" /> | ||
<PackageVersion Include="Scriban" Version="5.12.0" /> | ||
<PackageVersion Include="SharpZipLib" Version="1.4.2" /> | ||
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" /> | ||
<PackageVersion Include="System.Linq.Async" Version="6.0.1" /> | ||
</ItemGroup> | ||
<Project> | ||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.0" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> | ||
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" /> | ||
<PackageVersion Include="NuGet.PackageManagement" Version="6.12.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" /> | ||
<PackageVersion Include="NUglify" Version="1.21.10" /> | ||
<PackageVersion Include="nunit" Version="4.2.2" /> | ||
<PackageVersion Include="NUnit.Analyzers" Version="4.4.0" /> | ||
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" /> | ||
<PackageVersion Include="Scriban" Version="5.12.0" /> | ||
<PackageVersion Include="SharpZipLib" Version="1.4.2" /> | ||
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" /> | ||
<PackageVersion Include="System.Linq.Async" Version="6.0.1" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,44 @@ | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
using UnityNuGet; | ||
using UnityNuGet.Server; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
namespace UnityNuGet.Server | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
// Add the registry cache initializer | ||
builder.Services.AddHostedService<RegistryCacheInitializer>(); | ||
// Add the registry cache updater | ||
builder.Services.AddHostedService<RegistryCacheUpdater>(); | ||
// Add the registry cache report | ||
builder.Services.AddSingleton<RegistryCacheReport>(); | ||
builder.Services.AddSingleton<RegistryCacheSingleton>(); | ||
|
||
builder.Services.Configure<RegistryOptions>(builder.Configuration.GetSection("Registry")); | ||
builder.Services.AddSingleton<IValidateOptions<RegistryOptions>, ValidateRegistryOptions>(); | ||
builder.Services.AddOptionsWithValidateOnStart<RegistryOptions, ValidateRegistryOptions>(); | ||
|
||
builder.Services.AddApplicationInsightsTelemetry(); | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
//webBuilder.UseSetting("detailedErrors", "true"); | ||
webBuilder.ConfigureServices((context, services) => | ||
{ | ||
// Add the registry cache initializer | ||
services.AddHostedService<RegistryCacheInitializer>(); | ||
// Add the registry cache updater | ||
services.AddHostedService<RegistryCacheUpdater>(); | ||
// Add the registry cache report | ||
services.AddSingleton<RegistryCacheReport>(); | ||
services.AddSingleton<RegistryCacheSingleton>(); | ||
// Also enable NewtonsoftJson serialization | ||
builder.Services.AddControllers().AddNewtonsoftJson(); | ||
|
||
var app = builder.Build(); | ||
|
||
services.AddOptions<RegistryOptions>() | ||
.Bind(context.Configuration.GetSection("Registry")) | ||
.ValidateDataAnnotations(); | ||
}); | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
} | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
app.LogRequestHeaders(app.Services.GetRequiredService<ILoggerFactory>()); | ||
} | ||
else | ||
{ | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
app.UseHsts(); | ||
} | ||
app.UseRouting(); | ||
app.MapControllers(); | ||
app.MapStatus(); | ||
|
||
app.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.