Merge from migration/net-5
This commit is contained in:
commit
bbef451d53
@ -10,5 +10,5 @@ metadata:
|
|||||||
release: {{ .Release.Name }}
|
release: {{ .Release.Name }}
|
||||||
heritage: {{ .Release.Service }}
|
heritage: {{ .Release.Service }}
|
||||||
data:
|
data:
|
||||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }}
|
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }}
|
||||||
|
|
||||||
|
@ -10,5 +10,5 @@ metadata:
|
|||||||
release: {{ .Release.Name }}
|
release: {{ .Release.Name }}
|
||||||
heritage: {{ .Release.Service }}
|
heritage: {{ .Release.Service }}
|
||||||
data:
|
data:
|
||||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }}
|
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }}
|
||||||
|
|
||||||
|
@ -10,5 +10,5 @@ metadata:
|
|||||||
release: {{ .Release.Name }}
|
release: {{ .Release.Name }}
|
||||||
heritage: {{ .Release.Service }}
|
heritage: {{ .Release.Service }}
|
||||||
data:
|
data:
|
||||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 -}}
|
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 -}}
|
||||||
|
|
||||||
|
@ -10,5 +10,5 @@ metadata:
|
|||||||
release: {{ .Release.Name }}
|
release: {{ .Release.Name }}
|
||||||
heritage: {{ .Release.Service }}
|
heritage: {{ .Release.Service }}
|
||||||
data:
|
data:
|
||||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }}
|
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Grpc.Core;
|
using Grpc.Core;
|
||||||
using Grpc.Core.Interceptors;
|
using Grpc.Core.Interceptors;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure
|
||||||
@ -30,7 +29,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastruct
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = await t;
|
var response = await t;
|
||||||
_logger.LogDebug($"Response received: {response}");
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
catch (RpcException e)
|
catch (RpcException e)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<AssemblyName>Mobile.Shopping.HttpAggregator</AssemblyName>
|
<AssemblyName>Mobile.Shopping.HttpAggregator</AssemblyName>
|
||||||
<RootNamespace>Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator</RootNamespace>
|
<RootNamespace>Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator</RootNamespace>
|
||||||
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||||
@ -15,20 +15,20 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.0" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.1.2" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.0.0" />
|
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="3.1.2" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.11.2" />
|
<PackageReference Include="Google.Protobuf" Version="3.14.0" />
|
||||||
<PackageReference Include="Grpc.AspNetCore.Server.ClientFactory" Version="2.25.0" />
|
<PackageReference Include="Grpc.AspNetCore.Server.ClientFactory" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Core" Version="2.25.0" />
|
<PackageReference Include="Grpc.Core" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.25.0" />
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.25.0" PrivateAssets="All" />
|
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="3.1.0" />
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.1" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc5" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,48 +1,32 @@
|
|||||||
using CatalogApi;
|
using CatalogApi;
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
|
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static CatalogApi.Catalog;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
public class CatalogService : ICatalogService
|
public class CatalogService : ICatalogService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _httpClient;
|
private readonly Catalog.CatalogClient _client;
|
||||||
private readonly UrlsConfig _urls;
|
|
||||||
|
|
||||||
public CatalogService(HttpClient httpClient, IOptions<UrlsConfig> config)
|
public CatalogService(Catalog.CatalogClient client)
|
||||||
{
|
{
|
||||||
_httpClient = httpClient;
|
_client = client;
|
||||||
_urls = config.Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CatalogItem> GetCatalogItemAsync(int id)
|
public async Task<CatalogItem> GetCatalogItemAsync(int id)
|
||||||
{
|
{
|
||||||
|
var request = new CatalogItemRequest { Id = id };
|
||||||
return await GrpcCallerService.CallService(_urls.Catalog + UrlsConfig.CatalogOperations.GetItemById(id), async channel =>
|
var response = await _client.GetItemByIdAsync(request);
|
||||||
{
|
return MapToCatalogItemResponse(response);
|
||||||
var client = new CatalogClient(channel);
|
|
||||||
var request = new CatalogItemRequest { Id = id };
|
|
||||||
var response = await client.GetItemByIdAsync(request);
|
|
||||||
return MapToCatalogItemResponse(response);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids)
|
public async Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids)
|
||||||
{
|
{
|
||||||
|
var request = new CatalogItemsRequest { Ids = string.Join(",", ids), PageIndex = 1, PageSize = 10 };
|
||||||
return await GrpcCallerService.CallService(_urls.GrpcCatalog, async channel=>
|
var response = await _client.GetItemsByIdsAsync(request);
|
||||||
{
|
return response.Data.Select(MapToCatalogItemResponse);
|
||||||
var client = new CatalogClient(channel);
|
|
||||||
var request = new CatalogItemsRequest { Ids = string.Join(",", ids), PageIndex = 1, PageSize = 10 };
|
|
||||||
var response = await client.GetItemsByIdsAsync(request);
|
|
||||||
return response.Data.Select(this.MapToCatalogItemResponse);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CatalogItem MapToCatalogItemResponse(CatalogItemResponse catalogItemResponse)
|
private CatalogItem MapToCatalogItemResponse(CatalogItemResponse catalogItemResponse)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Devspaces.Support;
|
using CatalogApi;
|
||||||
|
using Devspaces.Support;
|
||||||
using GrpcBasket;
|
using GrpcBasket;
|
||||||
using GrpcOrdering;
|
using GrpcOrdering;
|
||||||
using HealthChecks.UI.Client;
|
using HealthChecks.UI.Client;
|
||||||
@ -182,9 +183,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
|||||||
|
|
||||||
//register http services
|
//register http services
|
||||||
|
|
||||||
services.AddHttpClient<ICatalogService, CatalogService>()
|
|
||||||
.AddDevspacesSupport();
|
|
||||||
|
|
||||||
services.AddHttpClient<IOrderApiClient, OrderApiClient>()
|
services.AddHttpClient<IOrderApiClient, OrderApiClient>()
|
||||||
.AddDevspacesSupport();
|
.AddDevspacesSupport();
|
||||||
|
|
||||||
@ -193,7 +191,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
|||||||
|
|
||||||
public static IServiceCollection AddGrpcServices(this IServiceCollection services)
|
public static IServiceCollection AddGrpcServices(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddSingleton<GrpcExceptionInterceptor>();
|
services.AddTransient<GrpcExceptionInterceptor>();
|
||||||
|
|
||||||
services.AddScoped<IBasketService, BasketService>();
|
services.AddScoped<IBasketService, BasketService>();
|
||||||
|
|
||||||
@ -203,6 +201,14 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
|||||||
options.Address = new Uri(basketApi);
|
options.Address = new Uri(basketApi);
|
||||||
}).AddInterceptor<GrpcExceptionInterceptor>();
|
}).AddInterceptor<GrpcExceptionInterceptor>();
|
||||||
|
|
||||||
|
services.AddScoped<ICatalogService, CatalogService>();
|
||||||
|
|
||||||
|
services.AddGrpcClient<Catalog.CatalogClient>((services, options) =>
|
||||||
|
{
|
||||||
|
var catalogApi = services.GetRequiredService<IOptions<UrlsConfig>>().Value.GrpcCatalog;
|
||||||
|
options.Address = new Uri(catalogApi);
|
||||||
|
}).AddInterceptor<GrpcExceptionInterceptor>();
|
||||||
|
|
||||||
services.AddScoped<IOrderingService, OrderingService>();
|
services.AddScoped<IOrderingService, OrderingService>();
|
||||||
|
|
||||||
services.AddGrpcClient<OrderingGrpc.OrderingGrpcClient>((services, options) =>
|
services.AddGrpcClient<OrderingGrpc.OrderingGrpcClient>((services, options) =>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Grpc.Core;
|
using Grpc.Core;
|
||||||
using Grpc.Core.Interceptors;
|
using Grpc.Core.Interceptors;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure
|
||||||
@ -30,7 +29,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = await t;
|
var response = await t;
|
||||||
_logger.LogDebug($"Response received: {response}");
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
catch (RpcException e)
|
catch (RpcException e)
|
||||||
|
@ -1,53 +1,41 @@
|
|||||||
using CatalogApi;
|
using CatalogApi;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static CatalogApi.Catalog;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
public class CatalogService : ICatalogService
|
public class CatalogService : ICatalogService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _httpClient;
|
private readonly Catalog.CatalogClient _client;
|
||||||
private readonly ILogger<CatalogService> _logger;
|
private readonly ILogger<CatalogService> _logger;
|
||||||
private readonly UrlsConfig _urls;
|
|
||||||
|
|
||||||
public CatalogService(HttpClient httpClient, ILogger<CatalogService> logger, IOptions<UrlsConfig> config)
|
public CatalogService(Catalog.CatalogClient client, ILogger<CatalogService> logger)
|
||||||
{
|
{
|
||||||
_httpClient = httpClient;
|
_client = client;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_urls = config.Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CatalogItem> GetCatalogItemAsync(int id)
|
public async Task<CatalogItem> GetCatalogItemAsync(int id)
|
||||||
{
|
{
|
||||||
return await GrpcCallerService.CallService(_urls.GrpcCatalog, async channel =>
|
var request = new CatalogItemRequest { Id = id };
|
||||||
{
|
_logger.LogInformation("grpc request {@request}", request);
|
||||||
var client = new CatalogClient(channel);
|
var response = await _client.GetItemByIdAsync(request);
|
||||||
var request = new CatalogItemRequest { Id = id };
|
_logger.LogInformation("grpc response {@response}", response);
|
||||||
_logger.LogInformation("grpc client created, request = {@request}", request);
|
return MapToCatalogItemResponse(response);
|
||||||
var response = await client.GetItemByIdAsync(request);
|
|
||||||
_logger.LogInformation("grpc response {@response}", response);
|
|
||||||
return MapToCatalogItemResponse(response);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids)
|
public async Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> ids)
|
||||||
{
|
{
|
||||||
return await GrpcCallerService.CallService(_urls.GrpcCatalog, async channel =>
|
var request = new CatalogItemsRequest { Ids = string.Join(",", ids), PageIndex = 1, PageSize = 10 };
|
||||||
{
|
_logger.LogInformation("grpc request {@request}", request);
|
||||||
var client = new CatalogClient(channel);
|
var response = await _client.GetItemsByIdsAsync(request);
|
||||||
var request = new CatalogItemsRequest { Ids = string.Join(",", ids), PageIndex = 1, PageSize = 10 };
|
_logger.LogInformation("grpc response {@response}", response);
|
||||||
_logger.LogInformation("grpc client created, request = {@request}", request);
|
return response.Data.Select(this.MapToCatalogItemResponse);
|
||||||
var response = await client.GetItemsByIdsAsync(request);
|
|
||||||
_logger.LogInformation("grpc response {@response}", response);
|
|
||||||
return response.Data.Select(this.MapToCatalogItemResponse);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CatalogItem MapToCatalogItemResponse(CatalogItemResponse catalogItemResponse)
|
private CatalogItem MapToCatalogItemResponse(CatalogItemResponse catalogItemResponse)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Devspaces.Support;
|
using CatalogApi;
|
||||||
|
using Devspaces.Support;
|
||||||
using GrpcBasket;
|
using GrpcBasket;
|
||||||
using GrpcOrdering;
|
using GrpcOrdering;
|
||||||
using HealthChecks.UI.Client;
|
using HealthChecks.UI.Client;
|
||||||
@ -185,9 +186,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
|
|||||||
|
|
||||||
//register http services
|
//register http services
|
||||||
|
|
||||||
services.AddHttpClient<ICatalogService, CatalogService>()
|
|
||||||
.AddDevspacesSupport();
|
|
||||||
|
|
||||||
services.AddHttpClient<IOrderApiClient, OrderApiClient>()
|
services.AddHttpClient<IOrderApiClient, OrderApiClient>()
|
||||||
.AddHttpMessageHandler<HttpClientAuthorizationDelegatingHandler>()
|
.AddHttpMessageHandler<HttpClientAuthorizationDelegatingHandler>()
|
||||||
.AddDevspacesSupport();
|
.AddDevspacesSupport();
|
||||||
@ -197,7 +195,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
|
|||||||
|
|
||||||
public static IServiceCollection AddGrpcServices(this IServiceCollection services)
|
public static IServiceCollection AddGrpcServices(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddSingleton<GrpcExceptionInterceptor>();
|
services.AddTransient<GrpcExceptionInterceptor>();
|
||||||
|
|
||||||
services.AddScoped<IBasketService, BasketService>();
|
services.AddScoped<IBasketService, BasketService>();
|
||||||
|
|
||||||
@ -207,6 +205,14 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
|
|||||||
options.Address = new Uri(basketApi);
|
options.Address = new Uri(basketApi);
|
||||||
}).AddInterceptor<GrpcExceptionInterceptor>();
|
}).AddInterceptor<GrpcExceptionInterceptor>();
|
||||||
|
|
||||||
|
services.AddScoped<ICatalogService, CatalogService>();
|
||||||
|
|
||||||
|
services.AddGrpcClient<Catalog.CatalogClient>((services, options) =>
|
||||||
|
{
|
||||||
|
var catalogApi = services.GetRequiredService<IOptions<UrlsConfig>>().Value.GrpcCatalog;
|
||||||
|
options.Address = new Uri(catalogApi);
|
||||||
|
}).AddInterceptor<GrpcExceptionInterceptor>();
|
||||||
|
|
||||||
services.AddScoped<IOrderingService, OrderingService>();
|
services.AddScoped<IOrderingService, OrderingService>();
|
||||||
|
|
||||||
services.AddGrpcClient<OrderingGrpc.OrderingGrpcClient>((services, options) =>
|
services.AddGrpcClient<OrderingGrpc.OrderingGrpcClient>((services, options) =>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<DebugType>portable</DebugType>
|
<DebugType>portable</DebugType>
|
||||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
<AssemblyName>Catalog.API</AssemblyName>
|
<AssemblyName>Catalog.API</AssemblyName>
|
||||||
@ -42,29 +42,30 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" Version="3.0.0" />
|
<PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" Version="3.2.2" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.AzureStorage" Version="3.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.AzureStorage" Version="3.3.1" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="3.0.3" />
|
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="3.1.4" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="3.0.0" />
|
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="3.2.0" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.0.0" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="3.1.2" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="5.0.1" />
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.11.2" />
|
<PackageReference Include="Google.Protobuf" Version="3.14.0" />
|
||||||
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.25.0" />
|
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.34.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.25.0" PrivateAssets="All" />
|
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" />
|
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.1" />
|
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.1.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.10" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.1.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.1" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
|
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.1-dev-00216" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.1-dev-00216" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
|
||||||
<PackageReference Include="Serilog.Sinks.Http" Version="5.2.0" />
|
<PackageReference Include="Serilog.Sinks.Http" Version="7.2.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Seq" Version="4.1.0-dev-00166" />
|
<PackageReference Include="Serilog.Sinks.Seq" Version="4.1.0-dev-00166" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc5" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||||
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
|
||||||
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.4.0-beta-24913-02" />
|
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.4.0-beta-24913-02" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
{
|
{
|
||||||
public class CatalogSettings
|
public class CatalogSettings
|
||||||
{
|
{
|
||||||
public string PicBaseUrl { get;set;}
|
public string PicBaseUrl { get; set; }
|
||||||
|
|
||||||
public string EventBusConnection { get; set; }
|
public string EventBusConnection { get; set; }
|
||||||
|
|
||||||
public bool UseCustomizationData { get; set; }
|
public bool UseCustomizationData { get; set; }
|
||||||
public bool AzureStorageEnabled { get; set; }
|
public bool AzureStorageEnabled { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
using Autofac.Extensions.DependencyInjection;
|
using Catalog.API.Extensions;
|
||||||
using Catalog.API.Extensions;
|
|
||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
|
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Catalog.API;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -12,121 +12,113 @@ using Microsoft.Extensions.Logging;
|
|||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
var configuration = GetConfiguration();
|
||||||
|
|
||||||
|
Log.Logger = CreateSerilogLogger(configuration);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
public class Program
|
Log.Information("Configuring web host ({ApplicationContext})...", Program.AppName);
|
||||||
|
var host = CreateHostBuilder(configuration, args);
|
||||||
|
|
||||||
|
Log.Information("Applying migrations ({ApplicationContext})...", Program.AppName);
|
||||||
|
host.MigrateDbContext<CatalogContext>((context, services) =>
|
||||||
{
|
{
|
||||||
public static readonly string Namespace = typeof(Program).Namespace;
|
var env = services.GetService<IWebHostEnvironment>();
|
||||||
public static readonly string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
var settings = services.GetService<IOptions<CatalogSettings>>();
|
||||||
|
var logger = services.GetService<ILogger<CatalogContextSeed>>();
|
||||||
|
|
||||||
public static int Main(string[] args)
|
new CatalogContextSeed()
|
||||||
{
|
.SeedAsync(context, env, settings, logger)
|
||||||
var configuration = GetConfiguration();
|
.Wait();
|
||||||
|
})
|
||||||
|
.MigrateDbContext<IntegrationEventLogContext>((_, __) => { });
|
||||||
|
|
||||||
Log.Logger = CreateSerilogLogger(configuration);
|
Log.Information("Starting web host ({ApplicationContext})...", Program.AppName);
|
||||||
|
host.Run();
|
||||||
|
|
||||||
try
|
return 0;
|
||||||
{
|
|
||||||
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
|
|
||||||
var host = CreateHostBuilder(configuration, args);
|
|
||||||
|
|
||||||
Log.Information("Applying migrations ({ApplicationContext})...", AppName);
|
|
||||||
host.MigrateDbContext<CatalogContext>((context, services) =>
|
|
||||||
{
|
|
||||||
var env = services.GetService<IWebHostEnvironment>();
|
|
||||||
var settings = services.GetService<IOptions<CatalogSettings>>();
|
|
||||||
var logger = services.GetService<ILogger<CatalogContextSeed>>();
|
|
||||||
|
|
||||||
new CatalogContextSeed()
|
|
||||||
.SeedAsync(context, env, settings, logger)
|
|
||||||
.Wait();
|
|
||||||
})
|
|
||||||
.MigrateDbContext<IntegrationEventLogContext>((_, __) => { });
|
|
||||||
|
|
||||||
Log.Information("Starting web host ({ApplicationContext})...", AppName);
|
|
||||||
host.Run();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", AppName);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Log.CloseAndFlush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IWebHost CreateHostBuilder(IConfiguration configuration, string[] args) =>
|
|
||||||
WebHost.CreateDefaultBuilder(args)
|
|
||||||
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
|
|
||||||
.CaptureStartupErrors(false)
|
|
||||||
.ConfigureKestrel(options =>
|
|
||||||
{
|
|
||||||
var ports = GetDefinedPorts(configuration);
|
|
||||||
options.Listen(IPAddress.Any, ports.httpPort, listenOptions =>
|
|
||||||
{
|
|
||||||
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
|
|
||||||
});
|
|
||||||
options.Listen(IPAddress.Any, ports.grpcPort, listenOptions =>
|
|
||||||
{
|
|
||||||
listenOptions.Protocols = HttpProtocols.Http2;
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
.UseStartup<Startup>()
|
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
||||||
.UseWebRoot("Pics")
|
|
||||||
.UseSerilog()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
|
|
||||||
var logstashUrl = configuration["Serilog:LogstashgUrl"];
|
|
||||||
return new LoggerConfiguration()
|
|
||||||
.MinimumLevel.Verbose()
|
|
||||||
.Enrich.WithProperty("ApplicationContext", AppName)
|
|
||||||
.Enrich.FromLogContext()
|
|
||||||
.WriteTo.Console()
|
|
||||||
.WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl)
|
|
||||||
.WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://logstash:8080" : logstashUrl)
|
|
||||||
.ReadFrom.Configuration(configuration)
|
|
||||||
.CreateLogger();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static (int httpPort, int grpcPort) GetDefinedPorts(IConfiguration config)
|
|
||||||
{
|
|
||||||
var grpcPort = config.GetValue("GRPC_PORT", 81);
|
|
||||||
var port = config.GetValue("PORT", 80);
|
|
||||||
return (port, grpcPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IConfiguration GetConfiguration()
|
|
||||||
{
|
|
||||||
var builder = new ConfigurationBuilder()
|
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
|
||||||
.AddEnvironmentVariables();
|
|
||||||
|
|
||||||
var config = builder.Build();
|
|
||||||
|
|
||||||
if (config.GetValue<bool>("UseVault", false))
|
|
||||||
{
|
|
||||||
builder.AddAzureKeyVault(
|
|
||||||
$"https://{config["Vault:Name"]}.vault.azure.net/",
|
|
||||||
config["Vault:ClientId"],
|
|
||||||
config["Vault:ClientSecret"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder.Build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", Program.AppName);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
|
}
|
||||||
|
|
||||||
|
IWebHost CreateHostBuilder(IConfiguration configuration, string[] args) =>
|
||||||
|
WebHost.CreateDefaultBuilder(args)
|
||||||
|
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
|
||||||
|
.CaptureStartupErrors(false)
|
||||||
|
.ConfigureKestrel(options =>
|
||||||
|
{
|
||||||
|
var ports = GetDefinedPorts(configuration);
|
||||||
|
options.Listen(IPAddress.Any, ports.httpPort, listenOptions =>
|
||||||
|
{
|
||||||
|
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
|
||||||
|
});
|
||||||
|
options.Listen(IPAddress.Any, ports.grpcPort, listenOptions =>
|
||||||
|
{
|
||||||
|
listenOptions.Protocols = HttpProtocols.Http2;
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseWebRoot("Pics")
|
||||||
|
.UseSerilog()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
|
||||||
|
var logstashUrl = configuration["Serilog:LogstashgUrl"];
|
||||||
|
return new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Verbose()
|
||||||
|
.Enrich.WithProperty("ApplicationContext", Program.AppName)
|
||||||
|
.Enrich.FromLogContext()
|
||||||
|
.WriteTo.Console()
|
||||||
|
.WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl)
|
||||||
|
.WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://logstash:8080" : logstashUrl)
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.CreateLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
(int httpPort, int grpcPort) GetDefinedPorts(IConfiguration config)
|
||||||
|
{
|
||||||
|
var grpcPort = config.GetValue("GRPC_PORT", 81);
|
||||||
|
var port = config.GetValue("PORT", 80);
|
||||||
|
return (port, grpcPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
IConfiguration GetConfiguration()
|
||||||
|
{
|
||||||
|
var builder = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.AddEnvironmentVariables();
|
||||||
|
|
||||||
|
var config = builder.Build();
|
||||||
|
|
||||||
|
if (config.GetValue<bool>("UseVault", false))
|
||||||
|
{
|
||||||
|
builder.AddAzureKeyVault(
|
||||||
|
$"https://{config["Vault:Name"]}.vault.azure.net/",
|
||||||
|
config["Vault:ClientId"],
|
||||||
|
config["Vault:ClientSecret"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static string Namespace = typeof(Startup).Namespace;
|
||||||
|
public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
|
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
|
||||||
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||||
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ConsentInputModel
|
public record ConsentInputModel
|
||||||
{
|
{
|
||||||
public string Button { get; set; }
|
public string Button { get; init; }
|
||||||
public IEnumerable<string> ScopesConsented { get; set; }
|
public IEnumerable<string> ScopesConsented { get; init; }
|
||||||
public bool RememberConsent { get; set; }
|
public bool RememberConsent { get; init; }
|
||||||
public string ReturnUrl { get; set; }
|
public string ReturnUrl { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using IdentityServer4.Models;
|
using IdentityServer4.Models;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ConsentViewModel : ConsentInputModel
|
public record ConsentViewModel : ConsentInputModel
|
||||||
{
|
{
|
||||||
public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, Client client, Resources resources)
|
public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, Client client, Resources resources)
|
||||||
{
|
{
|
||||||
@ -24,16 +22,16 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewMo
|
|||||||
ResourceScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray();
|
ResourceScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ClientName { get; set; }
|
public string ClientName { get; init; }
|
||||||
public string ClientUrl { get; set; }
|
public string ClientUrl { get; init; }
|
||||||
public string ClientLogoUrl { get; set; }
|
public string ClientLogoUrl { get; init; }
|
||||||
public bool AllowRememberConsent { get; set; }
|
public bool AllowRememberConsent { get; init; }
|
||||||
|
|
||||||
public IEnumerable<ScopeViewModel> IdentityScopes { get; set; }
|
public IEnumerable<ScopeViewModel> IdentityScopes { get; init; }
|
||||||
public IEnumerable<ScopeViewModel> ResourceScopes { get; set; }
|
public IEnumerable<ScopeViewModel> ResourceScopes { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScopeViewModel
|
public record ScopeViewModel
|
||||||
{
|
{
|
||||||
public ScopeViewModel(Scope scope, bool check)
|
public ScopeViewModel(Scope scope, bool check)
|
||||||
{
|
{
|
||||||
@ -55,11 +53,11 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewMo
|
|||||||
Checked = check || identity.Required;
|
Checked = check || identity.Required;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; init; }
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; init; }
|
||||||
public string Description { get; set; }
|
public string Description { get; init; }
|
||||||
public bool Emphasize { get; set; }
|
public bool Emphasize { get; init; }
|
||||||
public bool Required { get; set; }
|
public bool Required { get; init; }
|
||||||
public bool Checked { get; set; }
|
public bool Checked { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ForgotPasswordViewModel
|
public record ForgotPasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
public string Email { get; set; }
|
public string Email { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class LoggedOutViewModel
|
public record LoggedOutViewModel
|
||||||
{
|
{
|
||||||
public string PostLogoutRedirectUri { get; set; }
|
public string PostLogoutRedirectUri { get; init; }
|
||||||
public string ClientName { get; set; }
|
public string ClientName { get; init; }
|
||||||
public string SignOutIframeUrl { get; set; }
|
public string SignOutIframeUrl { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class LoginViewModel
|
public record LoginViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class LogoutViewModel
|
public record LogoutViewModel
|
||||||
{
|
{
|
||||||
public string LogoutId { get; set; }
|
public string LogoutId { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,24 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class RegisterViewModel
|
public record RegisterViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
[Display(Name = "Email")]
|
[Display(Name = "Email")]
|
||||||
public string Email { get; set; }
|
public string Email { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Password")]
|
[Display(Name = "Password")]
|
||||||
public string Password { get; set; }
|
public string Password { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm password")]
|
[Display(Name = "Confirm password")]
|
||||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
|
|
||||||
public ApplicationUser User { get; set; }
|
public ApplicationUser User { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ResetPasswordViewModel
|
public record ResetPasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
public string Email { get; set; }
|
public string Email { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
public string Password { get; set; }
|
public string Password { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm password")]
|
[Display(Name = "Confirm password")]
|
||||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
|
|
||||||
public string Code { get; set; }
|
public string Code { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class SendCodeViewModel
|
public record SendCodeViewModel
|
||||||
{
|
{
|
||||||
public string SelectedProvider { get; set; }
|
public string SelectedProvider { get; init; }
|
||||||
|
|
||||||
public ICollection<SelectListItem> Providers { get; set; }
|
public ICollection<SelectListItem> Providers { get; init; }
|
||||||
|
|
||||||
public string ReturnUrl { get; set; }
|
public string ReturnUrl { get; init; }
|
||||||
|
|
||||||
public bool RememberMe { get; set; }
|
public bool RememberMe { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class VerifyCodeViewModel
|
public record VerifyCodeViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Provider { get; set; }
|
public string Provider { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Code { get; set; }
|
public string Code { get; init; }
|
||||||
|
|
||||||
public string ReturnUrl { get; set; }
|
public string ReturnUrl { get; init; }
|
||||||
|
|
||||||
[Display(Name = "Remember this browser?")]
|
[Display(Name = "Remember this browser?")]
|
||||||
public bool RememberBrowser { get; set; }
|
public bool RememberBrowser { get; init; }
|
||||||
|
|
||||||
[Display(Name = "Remember me?")]
|
[Display(Name = "Remember me?")]
|
||||||
public bool RememberMe { get; set; }
|
public bool RememberMe { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ using IdentityServer4.Models;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models
|
||||||
{
|
{
|
||||||
public class ErrorViewModel
|
public record ErrorViewModel
|
||||||
{
|
{
|
||||||
public ErrorMessage Error { get; set; }
|
public ErrorMessage Error { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class AddPhoneNumberViewModel
|
public record AddPhoneNumberViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[Phone]
|
[Phone]
|
||||||
[Display(Name = "Phone number")]
|
[Display(Name = "Phone number")]
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class ChangePasswordViewModel
|
public record ChangePasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Current password")]
|
[Display(Name = "Current password")]
|
||||||
public string OldPassword { get; set; }
|
public string OldPassword { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "New password")]
|
[Display(Name = "New password")]
|
||||||
public string NewPassword { get; set; }
|
public string NewPassword { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm new password")]
|
[Display(Name = "Confirm new password")]
|
||||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class ConfigureTwoFactorViewModel
|
public record ConfigureTwoFactorViewModel
|
||||||
{
|
{
|
||||||
public string SelectedProvider { get; set; }
|
public string SelectedProvider { get; init; }
|
||||||
|
|
||||||
public ICollection<SelectListItem> Providers { get; set; }
|
public ICollection<SelectListItem> Providers { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class FactorViewModel
|
public record FactorViewModel
|
||||||
{
|
{
|
||||||
public string Purpose { get; set; }
|
public string Purpose { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,16 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class IndexViewModel
|
public record IndexViewModel
|
||||||
{
|
{
|
||||||
public bool HasPassword { get; set; }
|
public bool HasPassword { get; init; }
|
||||||
|
|
||||||
public IList<UserLoginInfo> Logins { get; set; }
|
public IList<UserLoginInfo> Logins { get; init; }
|
||||||
|
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; init; }
|
||||||
|
|
||||||
public bool TwoFactor { get; set; }
|
public bool TwoFactor { get; init; }
|
||||||
|
|
||||||
public bool BrowserRemembered { get; set; }
|
public bool BrowserRemembered { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class SetPasswordViewModel
|
public record SetPasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "New password")]
|
[Display(Name = "New password")]
|
||||||
public string NewPassword { get; set; }
|
public string NewPassword { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm new password")]
|
[Display(Name = "Confirm new password")]
|
||||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class VerifyPhoneNumberViewModel
|
public record VerifyPhoneNumberViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Code { get; set; }
|
public string Code { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[Phone]
|
[Phone]
|
||||||
[Display(Name = "Phone number")]
|
[Display(Name = "Phone number")]
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using IdentityServer4.EntityFramework.DbContexts;
|
using IdentityServer4.EntityFramework.DbContexts;
|
||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Identity.API;
|
||||||
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
|
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -11,103 +12,92 @@ using Serilog;
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API
|
string Namespace = typeof(Startup).Namespace;
|
||||||
|
string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
||||||
|
|
||||||
|
var configuration = GetConfiguration();
|
||||||
|
|
||||||
|
Log.Logger = CreateSerilogLogger(configuration);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
public class Program
|
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
|
||||||
{
|
var host = BuildWebHost(configuration, args);
|
||||||
public static readonly string Namespace = typeof(Program).Namespace;
|
|
||||||
public static readonly string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
|
||||||
|
|
||||||
public static int Main(string[] args)
|
Log.Information("Applying migrations ({ApplicationContext})...", AppName);
|
||||||
|
host.MigrateDbContext<PersistedGrantDbContext>((_, __) => { })
|
||||||
|
.MigrateDbContext<ApplicationDbContext>((context, services) =>
|
||||||
{
|
{
|
||||||
var configuration = GetConfiguration();
|
var env = services.GetService<IWebHostEnvironment>();
|
||||||
|
var logger = services.GetService<ILogger<ApplicationDbContextSeed>>();
|
||||||
|
var settings = services.GetService<IOptions<AppSettings>>();
|
||||||
|
|
||||||
Log.Logger = CreateSerilogLogger(configuration);
|
new ApplicationDbContextSeed()
|
||||||
|
.SeedAsync(context, env, logger, settings)
|
||||||
try
|
.Wait();
|
||||||
{
|
})
|
||||||
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
|
.MigrateDbContext<ConfigurationDbContext>((context, services) =>
|
||||||
var host = BuildWebHost(configuration, args);
|
|
||||||
|
|
||||||
Log.Information("Applying migrations ({ApplicationContext})...", AppName);
|
|
||||||
host.MigrateDbContext<PersistedGrantDbContext>((_, __) => { })
|
|
||||||
.MigrateDbContext<ApplicationDbContext>((context, services) =>
|
|
||||||
{
|
|
||||||
var env = services.GetService<IWebHostEnvironment>();
|
|
||||||
var logger = services.GetService<ILogger<ApplicationDbContextSeed>>();
|
|
||||||
var settings = services.GetService<IOptions<AppSettings>>();
|
|
||||||
|
|
||||||
new ApplicationDbContextSeed()
|
|
||||||
.SeedAsync(context, env, logger, settings)
|
|
||||||
.Wait();
|
|
||||||
})
|
|
||||||
.MigrateDbContext<ConfigurationDbContext>((context, services) =>
|
|
||||||
{
|
|
||||||
new ConfigurationDbContextSeed()
|
|
||||||
.SeedAsync(context, configuration)
|
|
||||||
.Wait();
|
|
||||||
});
|
|
||||||
|
|
||||||
Log.Information("Starting web host ({ApplicationContext})...", AppName);
|
|
||||||
host.Run();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", AppName);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Log.CloseAndFlush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
|
|
||||||
WebHost.CreateDefaultBuilder(args)
|
|
||||||
.CaptureStartupErrors(false)
|
|
||||||
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
|
|
||||||
.UseStartup<Startup>()
|
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
||||||
.UseSerilog()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
|
|
||||||
{
|
{
|
||||||
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
|
new ConfigurationDbContextSeed()
|
||||||
var logstashUrl = configuration["Serilog:LogstashgUrl"];
|
.SeedAsync(context, configuration)
|
||||||
return new LoggerConfiguration()
|
.Wait();
|
||||||
.MinimumLevel.Verbose()
|
});
|
||||||
.Enrich.WithProperty("ApplicationContext", AppName)
|
|
||||||
.Enrich.FromLogContext()
|
|
||||||
.WriteTo.Console()
|
|
||||||
.WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl)
|
|
||||||
.WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://localhost:8080" : logstashUrl)
|
|
||||||
.ReadFrom.Configuration(configuration)
|
|
||||||
.CreateLogger();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IConfiguration GetConfiguration()
|
Log.Information("Starting web host ({ApplicationContext})...", AppName);
|
||||||
{
|
host.Run();
|
||||||
var builder = new ConfigurationBuilder()
|
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
|
||||||
.AddEnvironmentVariables();
|
|
||||||
|
|
||||||
var config = builder.Build();
|
return 0;
|
||||||
|
}
|
||||||
if (config.GetValue<bool>("UseVault", false))
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
builder.AddAzureKeyVault(
|
Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", AppName);
|
||||||
$"https://{config["Vault:Name"]}.vault.azure.net/",
|
return 1;
|
||||||
config["Vault:ClientId"],
|
}
|
||||||
config["Vault:ClientSecret"]);
|
finally
|
||||||
}
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
return builder.Build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
|
||||||
|
WebHost.CreateDefaultBuilder(args)
|
||||||
|
.CaptureStartupErrors(false)
|
||||||
|
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseSerilog()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
|
||||||
|
var logstashUrl = configuration["Serilog:LogstashgUrl"];
|
||||||
|
return new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Verbose()
|
||||||
|
.Enrich.WithProperty("ApplicationContext", AppName)
|
||||||
|
.Enrich.FromLogContext()
|
||||||
|
.WriteTo.Console()
|
||||||
|
.WriteTo.Seq(string.IsNullOrWhiteSpace(seqServerUrl) ? "http://seq" : seqServerUrl)
|
||||||
|
.WriteTo.Http(string.IsNullOrWhiteSpace(logstashUrl) ? "http://localhost:8080" : logstashUrl)
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.CreateLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
IConfiguration GetConfiguration()
|
||||||
|
{
|
||||||
|
var builder = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.AddEnvironmentVariables();
|
||||||
|
|
||||||
|
var config = builder.Build();
|
||||||
|
|
||||||
|
if (config.GetValue<bool>("UseVault", false))
|
||||||
|
{
|
||||||
|
builder.AddAzureKeyVault(
|
||||||
|
$"https://{config["Vault:Name"]}.vault.azure.net/",
|
||||||
|
config["Vault:ClientId"],
|
||||||
|
config["Vault:ClientSecret"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.Build();
|
||||||
|
}
|
@ -14,7 +14,7 @@ import { Header } from '../shared/components/header/header';
|
|||||||
exports: [BasketStatusComponent]
|
exports: [BasketStatusComponent]
|
||||||
})
|
})
|
||||||
export class BasketModule {
|
export class BasketModule {
|
||||||
static forRoot(): ModuleWithProviders {
|
static forRoot(): ModuleWithProviders<BasketModule> {
|
||||||
return {
|
return {
|
||||||
ngModule: BasketModule,
|
ngModule: BasketModule,
|
||||||
providers: [
|
providers: [
|
||||||
|
@ -22,14 +22,14 @@ export class CampaignsComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.configurationService.isReady) {
|
if (this.configurationService.isReady) {
|
||||||
|
this.isCampaignDetailFunctionEnabled = this.configurationService.serverSettings.activateCampaignDetailFunction;
|
||||||
this.getCampaigns(9, 0)
|
this.getCampaigns(9, 0)
|
||||||
} else {
|
} else {
|
||||||
this.configurationService.settingsLoaded$.subscribe(x => {
|
this.configurationService.settingsLoaded$.subscribe(x => {
|
||||||
|
this.isCampaignDetailFunctionEnabled = this.configurationService.serverSettings.activateCampaignDetailFunction;
|
||||||
this.getCampaigns(9, 0);
|
this.getCampaigns(9, 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isCampaignDetailFunctionEnabled = this.configurationService.serverSettings.activateCampaignDetailFunction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageChanged(value: any) {
|
onPageChanged(value: any) {
|
||||||
|
@ -56,6 +56,9 @@ export class CatalogComponent implements OnInit {
|
|||||||
|
|
||||||
onFilterApplied(event: any) {
|
onFilterApplied(event: any) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
this.brandSelected = this.brandSelected && this.brandSelected.toString() != "null" ? this.brandSelected : null;
|
||||||
|
this.typeSelected = this.typeSelected && this.typeSelected.toString() != "null" ? this.typeSelected : null;
|
||||||
this.getCatalog(this.paginationInfo.itemsPage, this.paginationInfo.actualPage, this.brandSelected, this.typeSelected);
|
this.getCatalog(this.paginationInfo.itemsPage, this.paginationInfo.actualPage, this.brandSelected, this.typeSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +85,7 @@ export class CatalogComponent implements OnInit {
|
|||||||
|
|
||||||
getCatalog(pageSize: number, pageIndex: number, brand?: number, type?: number) {
|
getCatalog(pageSize: number, pageIndex: number, brand?: number, type?: number) {
|
||||||
this.errorReceived = false;
|
this.errorReceived = false;
|
||||||
|
|
||||||
this.service.getCatalog(pageIndex, pageSize, brand, type)
|
this.service.getCatalog(pageIndex, pageSize, brand, type)
|
||||||
.pipe(catchError((err) => this.handleError(err)))
|
.pipe(catchError((err) => this.handleError(err)))
|
||||||
.subscribe(catalog => {
|
.subscribe(catalog => {
|
||||||
|
@ -29,7 +29,7 @@ export class Identity implements OnInit {
|
|||||||
this.service.AuthorizedCallback();
|
this.service.AuthorizedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('identity component, checking authorized' + this.service.IsAuthorized);
|
console.log('identity component, checking authorized ' + this.service.IsAuthorized);
|
||||||
this.authenticated = this.service.IsAuthorized;
|
this.authenticated = this.service.IsAuthorized;
|
||||||
|
|
||||||
if (this.authenticated) {
|
if (this.authenticated) {
|
||||||
|
@ -57,7 +57,7 @@ import { UppercasePipe } from './pipes/uppercase.pipe';
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class SharedModule {
|
export class SharedModule {
|
||||||
static forRoot(): ModuleWithProviders {
|
static forRoot(): ModuleWithProviders<SharedModule> {
|
||||||
return {
|
return {
|
||||||
ngModule: SharedModule,
|
ngModule: SharedModule,
|
||||||
providers: [
|
providers: [
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../out-tsc/app",
|
"outDir": "../out-tsc/app",
|
||||||
"module": "es2015",
|
|
||||||
"baseUrl": "",
|
"baseUrl": "",
|
||||||
"types": []
|
"types": []
|
||||||
},
|
},
|
||||||
"exclude": [
|
"files": [
|
||||||
"test.ts",
|
"main.ts",
|
||||||
"**/*.spec.ts"
|
"polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"Client/**/*.d.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../out-tsc/spec",
|
"outDir": "../out-tsc/spec",
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"baseUrl": "",
|
"baseUrl": "",
|
||||||
"types": [
|
"types": [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ARG NODE_IMAGE=node:8.16
|
ARG NODE_IMAGE=node:12.0
|
||||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
|
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
@ -27,6 +27,12 @@
|
|||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "6kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
"optimization": true,
|
"optimization": true,
|
||||||
"outputHashing": "all",
|
"outputHashing": "all",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
@ -119,10 +125,13 @@
|
|||||||
"schematics": {
|
"schematics": {
|
||||||
"@schematics/angular:component": {
|
"@schematics/angular:component": {
|
||||||
"prefix": "app",
|
"prefix": "app",
|
||||||
"styleext": "scss"
|
"style": "scss"
|
||||||
},
|
},
|
||||||
"@schematics/angular:directive": {
|
"@schematics/angular:directive": {
|
||||||
"prefix": "app"
|
"prefix": "app"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"cli": {
|
||||||
|
"analytics": false
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"IdentityUrl": "http://localhost:5105",
|
"IdentityUrl": "http://localhost:5105",
|
||||||
"MarketingUrl": "http://localhost:5110",
|
"MarketingUrl": "http://localhost:5203",
|
||||||
"CallBackUrl": "http://localhost:5104/",
|
"CallBackUrl": "http://localhost:5104/",
|
||||||
"PurchaseUrl": "http://localhost:5202",
|
"PurchaseUrl": "http://localhost:5202",
|
||||||
"PurchaseUrlHC": "http://localhost:5202/hc",
|
"PurchaseUrlHC": "http://localhost:5202/hc",
|
||||||
|
16920
src/Web/WebSPA/package-lock.json
generated
16920
src/Web/WebSPA/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,17 +27,18 @@
|
|||||||
"lint:ts": "tslint -c tslint.json Client/**/*.ts"
|
"lint:ts": "tslint -c tslint.json Client/**/*.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "8.2.14",
|
"@angular-devkit/schematics": "^11.0.4",
|
||||||
"@angular/common": "8.2.14",
|
"@angular/animations": "10.2.3",
|
||||||
"@angular/compiler": "8.2.14",
|
"@angular/common": "10.2.3",
|
||||||
"@angular/core": "8.2.14",
|
"@angular/compiler": "10.2.3",
|
||||||
"@angular/forms": "8.2.14",
|
"@angular/core": "10.2.3",
|
||||||
"@angular/platform-browser": "8.2.14",
|
"@angular/forms": "10.2.3",
|
||||||
"@angular/platform-browser-dynamic": "8.2.14",
|
"@angular/platform-browser": "10.2.3",
|
||||||
"@angular/platform-server": "8.2.14",
|
"@angular/platform-browser-dynamic": "10.2.3",
|
||||||
"@angular/router": "8.2.14",
|
"@angular/platform-server": "10.2.3",
|
||||||
|
"@angular/router": "10.2.3",
|
||||||
"@microsoft/signalr": "3.0.1",
|
"@microsoft/signalr": "3.0.1",
|
||||||
"@ng-bootstrap/ng-bootstrap": "5.2.1",
|
"@ng-bootstrap/ng-bootstrap": "^8.0.0",
|
||||||
"@popperjs/core": "2.0.0",
|
"@popperjs/core": "2.0.0",
|
||||||
"acorn": "^6.4.1",
|
"acorn": "^6.4.1",
|
||||||
"acorn-dynamic-import": "4.0.0",
|
"acorn-dynamic-import": "4.0.0",
|
||||||
@ -47,48 +48,50 @@
|
|||||||
"font-awesome": "4.7.0",
|
"font-awesome": "4.7.0",
|
||||||
"isomorphic-fetch": "2.2.1",
|
"isomorphic-fetch": "2.2.1",
|
||||||
"jquery": "3.5.0",
|
"jquery": "3.5.0",
|
||||||
"ngx-toastr": "10.1.0",
|
"ngx-toastr": "^13.2.0",
|
||||||
"normalize.css": "8.0.0",
|
"normalize.css": "8.0.0",
|
||||||
"popper.js": "1.16.1",
|
"popper.js": "1.16.1",
|
||||||
"rxjs": "~6.4.0",
|
"rxjs": "^6.5.2",
|
||||||
"rxjs-compat": "~6.4.0",
|
"rxjs-compat": "^6.5.2",
|
||||||
|
"tslib": "^2.0.0",
|
||||||
"typedoc": "^0.19.2",
|
"typedoc": "^0.19.2",
|
||||||
"webpack-dev-server": "3.1.14",
|
"webpack-dev-server": "3.1.14",
|
||||||
"zone.js": "~0.9.1"
|
"zone.js": "~0.10.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "0.803.23",
|
"@angular-devkit/build-angular": "~0.1002.0",
|
||||||
"@angular/cli": "8.3.23",
|
"@angular/cli": "10.2.0",
|
||||||
"@angular/compiler-cli": "8.2.14",
|
"@angular/compiler-cli": "10.2.3",
|
||||||
"@angular/language-service": "8.2.14",
|
"@angular/language-service": "10.2.3",
|
||||||
"@types/core-js": "2.5.0",
|
"@types/core-js": "2.5.0",
|
||||||
"@types/hammerjs": "2.0.35",
|
"@types/hammerjs": "2.0.35",
|
||||||
"@types/jasmine": "^3.5.10",
|
"@types/jasmine": "^3.5.10",
|
||||||
"@types/node": "^11.15.9",
|
"@types/node": "^12.11.1",
|
||||||
"@types/protractor": "4.0.0",
|
"@types/protractor": "4.0.0",
|
||||||
"@types/selenium-webdriver": "3.0.10",
|
"@types/selenium-webdriver": "3.0.10",
|
||||||
"codelyzer": "^5.2.2",
|
"codelyzer": "^5.1.2",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"handlebars": "^4.7.6",
|
"handlebars": "^4.7.6",
|
||||||
"jasmine-core": "^3.5.0",
|
"jasmine-core": "~3.5.0",
|
||||||
"jasmine-spec-reporter": "^4.2.1",
|
"jasmine-spec-reporter": "~5.0.0",
|
||||||
"karma": "^4.4.1",
|
"karma": "~5.0.0",
|
||||||
"karma-chrome-launcher": "^2.2.0",
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
"karma-cli": "^2.0.0",
|
"karma-cli": "^2.0.0",
|
||||||
"karma-jasmine": "^2.0.1",
|
"karma-jasmine": "~4.0.0",
|
||||||
"karma-jasmine-html-reporter": "^1.5.3",
|
"karma-jasmine-html-reporter": "^1.5.0",
|
||||||
"lodash": "^4.17.19",
|
"lodash": "^4.17.19",
|
||||||
"merge": "1.2.1",
|
"merge": "1.2.1",
|
||||||
"npm-watch": "0.5.0",
|
"npm-watch": "0.5.0",
|
||||||
"protractor": "^5.4.3",
|
"protractor": "~7.0.0",
|
||||||
"rxjs-tslint": "^0.1.7",
|
"rxjs-tslint": "^0.1.7",
|
||||||
"sass-lint": "1.12.1",
|
"sass-lint": "1.12.1",
|
||||||
"ts-helpers": "1.1.2",
|
"ts-helpers": "1.1.2",
|
||||||
"ts-node": "~7.0.1",
|
"ts-node": "~7.0.1",
|
||||||
"tslint": "^5.14.0",
|
"tslint": "~6.1.0",
|
||||||
"typedoc": "^0.19.2",
|
"typedoc": "^0.19.2",
|
||||||
"typescript": "3.4.5",
|
"typescript": "4.0.5",
|
||||||
"url-loader": "1.1.1",
|
"url-loader": "1.1.1",
|
||||||
"webpack": "^4.42.1"
|
"webpack": "^4.42.1"
|
||||||
}
|
},
|
||||||
|
"peerDependencies": {}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "es5",
|
"target": "es2018",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"es2016",
|
"es2016",
|
||||||
"dom"
|
"dom"
|
||||||
],
|
],
|
||||||
"module": "es2015"
|
"module": "es2020"
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"enableIvy": false
|
"enableIvy": false
|
||||||
|
@ -49,6 +49,9 @@
|
|||||||
true,
|
true,
|
||||||
"check-space"
|
"check-space"
|
||||||
],
|
],
|
||||||
|
"deprecation": {
|
||||||
|
"severity": "warning"
|
||||||
|
},
|
||||||
"indent": [
|
"indent": [
|
||||||
true,
|
true,
|
||||||
"spaces"
|
"spaces"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user