resolve conflicts
This commit is contained in:
commit
ce2724af69
9
ServiceFabric/Linux/.dockerignore
Normal file
9
ServiceFabric/Linux/.dockerignore
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.dockerignore
|
||||||
|
.env
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.vs
|
||||||
|
.vscode
|
||||||
|
*/bin
|
||||||
|
*/obj
|
||||||
|
**/.toolstarget
|
@ -6,6 +6,8 @@
|
|||||||
<ServerGarbageCollection>True</ServerGarbageCollection>
|
<ServerGarbageCollection>True</ServerGarbageCollection>
|
||||||
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
|
||||||
<TargetLatestRuntimePatch>False</TargetLatestRuntimePatch>
|
<TargetLatestRuntimePatch>False</TargetLatestRuntimePatch>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<UserSecretsId>860c6d00-8a17-45b6-be76-28c2395d468e</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -16,6 +18,7 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="3.3.617" />
|
<PackageReference Include="Microsoft.ServiceFabric.AspNetCore.Kestrel" Version="3.3.617" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "marketing.api",
|
"Host": "marketingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5110
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "locations.api",
|
"Host": "locationsapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5109
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
||||||
@ -26,9 +26,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"GlobalConfiguration": {
|
"GlobalConfiguration": {
|
||||||
"RequestIdKey": "OcRequestId",
|
"RequestIdKey": "OcRequestId",
|
||||||
"AdministrationPath": "/administration"
|
"AdministrationPath": "/administration"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,115 +1,115 @@
|
|||||||
{
|
{
|
||||||
"ReRoutes": [
|
"ReRoutes": [
|
||||||
{
|
{
|
||||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "catalog.api",
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5101
|
||||||
}
|
|
||||||
],
|
|
||||||
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
|
||||||
"UpstreamHttpMethod": [ "GET" ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
|
||||||
"DownstreamScheme": "http",
|
|
||||||
"DownstreamHostAndPorts": [
|
|
||||||
{
|
|
||||||
"Host": "basket.api",
|
|
||||||
"Port": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
|
||||||
"UpstreamHttpMethod": [],
|
|
||||||
"AuthenticationOptions": {
|
|
||||||
"AuthenticationProviderKey": "IdentityApiKey",
|
|
||||||
"AllowedScopes": []
|
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
{
|
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
||||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
"UpstreamHttpMethod": [ "GET" ]
|
||||||
"DownstreamScheme": "http",
|
},
|
||||||
"DownstreamHostAndPorts": [
|
{
|
||||||
{
|
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||||
"Host": "ordering.api",
|
"DownstreamScheme": "http",
|
||||||
"Port": 80
|
"DownstreamHostAndPorts": [
|
||||||
}
|
{
|
||||||
],
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
"Port": 5103
|
||||||
"UpstreamHttpMethod": [],
|
|
||||||
"AuthenticationOptions": {
|
|
||||||
"AuthenticationProviderKey": "IdentityApiKey",
|
|
||||||
"AllowedScopes": []
|
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
{
|
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
||||||
"DownstreamPathTemplate": "/{everything}",
|
"UpstreamHttpMethod": [],
|
||||||
"DownstreamScheme": "http",
|
"AuthenticationOptions": {
|
||||||
"DownstreamHostAndPorts": [
|
"AuthenticationProviderKey": "IdentityApiKey",
|
||||||
{
|
"AllowedScopes": []
|
||||||
"Host": "mobileshoppingagg",
|
|
||||||
"Port": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UpstreamPathTemplate": "/{everything}",
|
|
||||||
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
|
|
||||||
"AuthenticationOptions": {
|
|
||||||
"AuthenticationProviderKey": "IdentityApiKey",
|
|
||||||
"AllowedScopes": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DownstreamPathTemplate": "/{everything}",
|
|
||||||
"DownstreamScheme": "http",
|
|
||||||
"DownstreamHostAndPorts": [
|
|
||||||
{
|
|
||||||
"Host": "ordering.api",
|
|
||||||
"Port": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
|
||||||
"UpstreamHttpMethod": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DownstreamPathTemplate": "/{everything}",
|
|
||||||
"DownstreamScheme": "http",
|
|
||||||
"DownstreamHostAndPorts": [
|
|
||||||
{
|
|
||||||
"Host": "basket.api",
|
|
||||||
"Port": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UpstreamPathTemplate": "/basket-api/{everything}",
|
|
||||||
"UpstreamHttpMethod": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DownstreamPathTemplate": "/{everything}",
|
|
||||||
"DownstreamScheme": "http",
|
|
||||||
"DownstreamHostAndPorts": [
|
|
||||||
{
|
|
||||||
"Host": "catalog.api",
|
|
||||||
"Port": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
|
||||||
"UpstreamHttpMethod": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DownstreamPathTemplate": "/{everything}",
|
|
||||||
"DownstreamScheme": "http",
|
|
||||||
"DownstreamHostAndPorts": [
|
|
||||||
{
|
|
||||||
"Host": "payment.api",
|
|
||||||
"Port": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UpstreamPathTemplate": "/payment-api/{everything}",
|
|
||||||
"UpstreamHttpMethod": []
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
],
|
{
|
||||||
|
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
|
"Port": 5102
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
||||||
|
"UpstreamHttpMethod": [],
|
||||||
|
"AuthenticationOptions": {
|
||||||
|
"AuthenticationProviderKey": "IdentityApiKey",
|
||||||
|
"AllowedScopes": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DownstreamPathTemplate": "/{everything}",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "mobileshoppingagg.eshoponservicefabric",
|
||||||
|
"Port": 5120
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UpstreamPathTemplate": "/{everything}",
|
||||||
|
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
|
||||||
|
"AuthenticationOptions": {
|
||||||
|
"AuthenticationProviderKey": "IdentityApiKey",
|
||||||
|
"AllowedScopes": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DownstreamPathTemplate": "/{everything}",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
|
"Port": 5102
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||||
|
"UpstreamHttpMethod": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DownstreamPathTemplate": "/{everything}",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
|
"Port": 5103
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UpstreamPathTemplate": "/basket-api/{everything}",
|
||||||
|
"UpstreamHttpMethod": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DownstreamPathTemplate": "/{everything}",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
|
"Port": 5101
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
||||||
|
"UpstreamHttpMethod": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DownstreamPathTemplate": "/{everything}",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "paymentapi.eshoponservicefabric",
|
||||||
|
"Port": 5108
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UpstreamPathTemplate": "/payment-api/{everything}",
|
||||||
|
"UpstreamHttpMethod": []
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
"GlobalConfiguration": {
|
"GlobalConfiguration": {
|
||||||
"RequestIdKey": "OcRequestId",
|
"RequestIdKey": "OcRequestId",
|
||||||
"AdministrationPath": "/administration"
|
"AdministrationPath": "/administration"
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "marketing.api",
|
"Host": "marketingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5110
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "locations.api",
|
"Host": "locationsapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5109
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "catalog.api",
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5101
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "basket.api",
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5103
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
||||||
@ -33,8 +33,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.api",
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5102
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
||||||
@ -49,8 +49,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "webshoppingagg",
|
"Host": "webshoppingagg.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5121
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/{everything}",
|
"UpstreamPathTemplate": "/{everything}",
|
||||||
@ -65,8 +65,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.api",
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5102
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||||
@ -77,7 +77,7 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.signalrhub",
|
"Host": "ordering.signalrhub.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 80
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -89,8 +89,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "basket.api",
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5103
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/basket-api/{everything}",
|
"UpstreamPathTemplate": "/basket-api/{everything}",
|
||||||
@ -101,8 +101,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "catalog.api",
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5101
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
||||||
@ -113,8 +113,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "payment.api",
|
"Host": "paymentapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5108
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/payment-api/{everything}",
|
"UpstreamPathTemplate": "/payment-api/{everything}",
|
||||||
|
@ -11,20 +11,20 @@ namespace ApiGw_Base.Controllers
|
|||||||
public class ConfigurationController : ControllerBase
|
public class ConfigurationController : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("mobile/marketing")]
|
[HttpGet("mobile/marketing")]
|
||||||
public IActionResult MobileMarketing() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Marketing);
|
public IActionResult MobileMarketing() => ReadConfigurationFile(Channel.Mobile, ChannelType.Marketing);
|
||||||
|
|
||||||
[HttpGet("mobile/shopping")]
|
[HttpGet("mobile/shopping")]
|
||||||
public IActionResult MobileShopping() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Shopping);
|
public IActionResult MobileShopping() => ReadConfigurationFile(Channel.Mobile, ChannelType.Shopping);
|
||||||
|
|
||||||
[HttpGet("web/marketing")]
|
[HttpGet("web/marketing")]
|
||||||
public IActionResult WebMarketing() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Marketing);
|
public IActionResult WebMarketing() => ReadConfigurationFile(Channel.Web, ChannelType.Marketing);
|
||||||
|
|
||||||
[HttpGet("web/shopping")]
|
[HttpGet("web/shopping")]
|
||||||
public IActionResult WebShopping() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Shopping);
|
public IActionResult WebShopping() => ReadConfigurationFile(Channel.Web, ChannelType.Shopping);
|
||||||
|
|
||||||
private IActionResult ReadConfigurationFile(ConfigurationType configurationType, ConfigurationBffType configurationBffType)
|
private IActionResult ReadConfigurationFile(Channel channel, ChannelType channelType)
|
||||||
{
|
{
|
||||||
var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{configurationType}.Bff.{configurationBffType}.json";
|
var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{channel}.Bff.{channelType}.json";
|
||||||
|
|
||||||
using (var streamReader = new StreamReader(path, Encoding.UTF8))
|
using (var streamReader = new StreamReader(path, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@ namespace ApiGw_Base.Controllers
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(jsonString))
|
if (string.IsNullOrWhiteSpace(jsonString))
|
||||||
{
|
{
|
||||||
return BadRequest($"Configuration file 'configuration.{configurationType}.Bff.{configurationBffType}.json' not found");
|
return BadRequest($"Configuration file 'configuration.{channel}.Bff.{channelType}.json' not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(jsonString);
|
return Ok(jsonString);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace ApiGw_Base.Enums
|
namespace ApiGw_Base.Enums
|
||||||
{
|
{
|
||||||
public enum ConfigurationType
|
public enum Channel
|
||||||
{
|
{
|
||||||
Web,
|
Web,
|
||||||
Mobile
|
Mobile
|
@ -1,6 +1,6 @@
|
|||||||
namespace ApiGw_Base.Enums
|
namespace ApiGw_Base.Enums
|
||||||
{
|
{
|
||||||
public enum ConfigurationBffType
|
public enum ChannelType
|
||||||
{
|
{
|
||||||
Marketing,
|
Marketing,
|
||||||
Shopping
|
Shopping
|
@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
|
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
|
||||||
<!-- Add your custom configuration sections and parameters here -->
|
<!-- Add your custom configuration sections and parameters here -->
|
||||||
<!--
|
<!--<Section Name="ServiceFabricSettings">
|
||||||
<Section Name="MyConfigSection">
|
<Parameter Name="UrlMobilMarketing" Value="configuration/mobile/marketing" />
|
||||||
<Parameter Name="MyParameter" Value="Value1" />
|
<Parameter Name="UrlMobilShopping" Value="/configuration/mobile/shopping" />
|
||||||
</Section>
|
<Parameter Name="UrlWebMarketing" Value="/configuration/web/marketing" />
|
||||||
-->
|
<Parameter Name="UrlWebShopping" Value="/configuration/web/shopping" />
|
||||||
|
</Section>-->
|
||||||
</Settings>
|
</Settings>
|
||||||
|
@ -17,9 +17,18 @@
|
|||||||
<Program>ApiGw_Base.exe</Program>
|
<Program>ApiGw_Base.exe</Program>
|
||||||
<WorkingFolder>CodePackage</WorkingFolder>
|
<WorkingFolder>CodePackage</WorkingFolder>
|
||||||
</ExeHost>
|
</ExeHost>
|
||||||
|
<!--<ContainerHost>
|
||||||
|
<ImageName>eshop/sf.linux.settings.api:#{tag}#</ImageName>
|
||||||
|
</ContainerHost>-->
|
||||||
</EntryPoint>
|
</EntryPoint>
|
||||||
<EnvironmentVariables>
|
<EnvironmentVariables>
|
||||||
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value=""/>
|
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
|
||||||
|
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
|
||||||
|
<EnvironmentVariable Name="UrlMobilMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/mobile/marketing" />
|
||||||
|
<EnvironmentVariable Name="UrlMobilShopping" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/mobile/shopping" />
|
||||||
|
<EnvironmentVariable Name="UrlWebMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/web/marketing" />
|
||||||
|
<EnvironmentVariable Name="UrlWebShopping" Value="http://apigw_base.eshoponservicefabricapigwtype/configuration/web/shopping" />
|
||||||
|
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
|
||||||
</EnvironmentVariables>
|
</EnvironmentVariables>
|
||||||
</CodePackage>
|
</CodePackage>
|
||||||
|
|
||||||
@ -32,6 +41,7 @@
|
|||||||
<!-- This endpoint is used by the communication listener to obtain the port on which to
|
<!-- This endpoint is used by the communication listener to obtain the port on which to
|
||||||
listen. Please note that if your service is partitioned, this port is shared with
|
listen. Please note that if your service is partitioned, this port is shared with
|
||||||
replicas of different partitions that are placed in your code. -->
|
replicas of different partitions that are placed in your code. -->
|
||||||
|
<!--<Endpoint UriScheme="http" Name="sf.linux.settings.api.endpoint" Port="8912" />-->
|
||||||
<Endpoint Protocol="https" Name="ServiceEndpoint" Type="Input" Port="8912" />
|
<Endpoint Protocol="https" Name="ServiceEndpoint" Type="Input" Port="8912" />
|
||||||
</Endpoints>
|
</Endpoints>
|
||||||
</Resources>
|
</Resources>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
"iisSettings": {
|
||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
"iisExpress": {
|
"iisExpress": {
|
||||||
"applicationUrl": "http://localhost:51647",
|
"applicationUrl": "http://localhost:51647",
|
||||||
"sslPort": 44363
|
"sslPort": 44363
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
@ -21,10 +21,15 @@
|
|||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "api/values",
|
"launchUrl": "api/values",
|
||||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||||
|
},
|
||||||
|
"Docker": {
|
||||||
|
"commandName": "Docker",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,6 +13,11 @@
|
|||||||
<EnvironmentOverrides CodePackageRef="code">
|
<EnvironmentOverrides CodePackageRef="code">
|
||||||
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="[ApiGw_Base_ASPNETCORE_ENVIRONMENT]" />
|
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="[ApiGw_Base_ASPNETCORE_ENVIRONMENT]" />
|
||||||
</EnvironmentOverrides>
|
</EnvironmentOverrides>
|
||||||
|
<!--<Policies>
|
||||||
|
<ContainerHostPolicies CodePackageRef="Code">
|
||||||
|
<PortBinding ContainerPort="80" EndpointRef="sf.linux.settings.api.endpoint" />
|
||||||
|
</ContainerHostPolicies>
|
||||||
|
</Policies>-->
|
||||||
</ServiceManifestImport>
|
</ServiceManifestImport>
|
||||||
<DefaultServices>
|
<DefaultServices>
|
||||||
<!-- The section below creates instances of service types, when an instance of this
|
<!-- The section below creates instances of service types, when an instance of this
|
||||||
@ -20,7 +25,7 @@
|
|||||||
ServiceFabric PowerShell module.
|
ServiceFabric PowerShell module.
|
||||||
|
|
||||||
The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
|
The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
|
||||||
<Service Name="ApiGw_Base" ServicePackageActivationMode="ExclusiveProcess">
|
<Service Name="ApiGw_Base" ServiceDnsName="apigw_base.eshoponservicefabricapigwtype" ServicePackageActivationMode="ExclusiveProcess">
|
||||||
<StatelessService ServiceTypeName="ApiGw_BaseType" InstanceCount="[ApiGw_Base_InstanceCount]">
|
<StatelessService ServiceTypeName="ApiGw_BaseType" InstanceCount="[ApiGw_Base_InstanceCount]">
|
||||||
<SingletonPartition />
|
<SingletonPartition />
|
||||||
</StatelessService>
|
</StatelessService>
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
|
||||||
|
<!-- Add your custom configuration sections and parameters here -->
|
||||||
|
<!--
|
||||||
|
<Section Name="MyConfigSection">
|
||||||
|
<Parameter Name="MyParameter" Value="Value1" />
|
||||||
|
</Section>
|
||||||
|
-->
|
||||||
|
</Settings>
|
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ServiceManifest Name="OrderingSignalrhubPkg"
|
||||||
|
Version="1.0.0"
|
||||||
|
xmlns="http://schemas.microsoft.com/2011/01/fabric"
|
||||||
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<ServiceTypes>
|
||||||
|
<!-- This is the name of your ServiceType.
|
||||||
|
The UseImplicitHost attribute indicates this is a guest service. -->
|
||||||
|
<StatelessServiceType ServiceTypeName="OrderingSignalrhubType" UseImplicitHost="true" />
|
||||||
|
</ServiceTypes>
|
||||||
|
|
||||||
|
<!-- Code package is your service executable. -->
|
||||||
|
<CodePackage Name="Code" Version="1.0.0">
|
||||||
|
<EntryPoint>
|
||||||
|
<!-- Follow this link for more information about deploying Windows containers to Service Fabric: https://aka.ms/sfguestcontainers -->
|
||||||
|
<ContainerHost>
|
||||||
|
<ImageName>eshop/ordering.signalrhub:#{tag}#</ImageName>
|
||||||
|
</ContainerHost>
|
||||||
|
</EntryPoint>
|
||||||
|
<!-- Pass environment variables to your container: -->
|
||||||
|
<!--
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable Name="VariableName" Value="VariableValue"/>
|
||||||
|
</EnvironmentVariables>
|
||||||
|
-->
|
||||||
|
</CodePackage>
|
||||||
|
|
||||||
|
<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
|
||||||
|
independently-updateable and versioned set of custom configuration settings for your service. -->
|
||||||
|
<ConfigPackage Name="Config" Version="1.0.0" />
|
||||||
|
|
||||||
|
<Resources>
|
||||||
|
<Endpoints>
|
||||||
|
<!-- This endpoint is used by the communication listener to obtain the port on which to
|
||||||
|
listen. Please note that if your service is partitioned, this port is shared with
|
||||||
|
replicas of different partitions that are placed in your code. -->
|
||||||
|
<Endpoint Name="OrderingSignalrhubTypeEndpoint" Port="5112" />
|
||||||
|
</Endpoints>
|
||||||
|
</Resources>
|
||||||
|
</ServiceManifest>
|
@ -5,8 +5,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "marketing.api",
|
"Host": "marketingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5110
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "locations.api",
|
"Host": "locationsapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5109
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "catalog.api",
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5101
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "basket.api",
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5103
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
||||||
@ -33,8 +33,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.api",
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5102
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
||||||
@ -49,8 +49,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "mobileshoppingagg",
|
"Host": "mobileshoppingagg.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5120
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/{everything}",
|
"UpstreamPathTemplate": "/{everything}",
|
||||||
@ -65,8 +65,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.api",
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5102
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||||
@ -77,8 +77,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "basket.api",
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5103
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/basket-api/{everything}",
|
"UpstreamPathTemplate": "/basket-api/{everything}",
|
||||||
@ -89,8 +89,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "catalog.api",
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5101
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
||||||
@ -101,8 +101,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "payment.api",
|
"Host": "paymentapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5108
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/payment-api/{everything}",
|
"UpstreamPathTemplate": "/payment-api/{everything}",
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "marketing.api",
|
"Host": "marketingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5110
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "locations.api",
|
"Host": "locationsapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5109
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "catalog.api",
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5101
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "basket.api",
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5103
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
||||||
@ -33,8 +33,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.api",
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5102
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
||||||
@ -49,8 +49,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "webshoppingagg",
|
"Host": "webshoppingagg.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5121
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/{everything}",
|
"UpstreamPathTemplate": "/{everything}",
|
||||||
@ -65,8 +65,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.api",
|
"Host": "orderingapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5102
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||||
@ -77,7 +77,7 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "ordering.signalrhub",
|
"Host": "ordering.signalrhub.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 80
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -89,8 +89,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "basket.api",
|
"Host": "basketapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5103
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/basket-api/{everything}",
|
"UpstreamPathTemplate": "/basket-api/{everything}",
|
||||||
@ -101,8 +101,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "catalog.api",
|
"Host": "catalogapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5101
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
||||||
@ -113,8 +113,8 @@
|
|||||||
"DownstreamScheme": "http",
|
"DownstreamScheme": "http",
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "payment.api",
|
"Host": "paymentapi.eshoponservicefabric",
|
||||||
"Port": 80
|
"Port": 5108
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpstreamPathTemplate": "/payment-api/{everything}",
|
"UpstreamPathTemplate": "/payment-api/{everything}",
|
||||||
|
@ -11,20 +11,20 @@ namespace ApiGw_Base.Controllers
|
|||||||
public class ConfigurationController : ControllerBase
|
public class ConfigurationController : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("mobile/marketing")]
|
[HttpGet("mobile/marketing")]
|
||||||
public IActionResult MobileMarketing() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Marketing);
|
public IActionResult MobileMarketing() => ReadConfigurationFile(Channel.Mobile, ChannelType.Marketing);
|
||||||
|
|
||||||
[HttpGet("mobile/shopping")]
|
[HttpGet("mobile/shopping")]
|
||||||
public IActionResult MobileShopping() => ReadConfigurationFile(ConfigurationType.Mobile, ConfigurationBffType.Shopping);
|
public IActionResult MobileShopping() => ReadConfigurationFile(Channel.Mobile, ChannelType.Shopping);
|
||||||
|
|
||||||
[HttpGet("web/marketing")]
|
[HttpGet("web/marketing")]
|
||||||
public IActionResult WebMarketing() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Marketing);
|
public IActionResult WebMarketing() => ReadConfigurationFile(Channel.Web, ChannelType.Marketing);
|
||||||
|
|
||||||
[HttpGet("web/shopping")]
|
[HttpGet("web/shopping")]
|
||||||
public IActionResult WebShopping() => ReadConfigurationFile(ConfigurationType.Web, ConfigurationBffType.Shopping);
|
public IActionResult WebShopping() => ReadConfigurationFile(Channel.Web, ChannelType.Shopping);
|
||||||
|
|
||||||
private IActionResult ReadConfigurationFile(ConfigurationType configurationType, ConfigurationBffType configurationBffType)
|
private IActionResult ReadConfigurationFile(Channel channel, ChannelType channelType)
|
||||||
{
|
{
|
||||||
var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{configurationType}.Bff.{configurationBffType}.json";
|
var path = $"{AppDomain.CurrentDomain.BaseDirectory}/Configurations/configuration.{channel}.Bff.{channelType}.json";
|
||||||
|
|
||||||
using (var streamReader = new StreamReader(path, Encoding.UTF8))
|
using (var streamReader = new StreamReader(path, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@ namespace ApiGw_Base.Controllers
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(jsonString))
|
if (string.IsNullOrWhiteSpace(jsonString))
|
||||||
{
|
{
|
||||||
return BadRequest($"Configuration file 'configuration.{configurationType}.Bff.{configurationBffType}.json' not found");
|
return BadRequest($"Configuration file 'configuration.{channel}.Bff.{channelType}.json' not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(jsonString);
|
return Ok(jsonString);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace ApiGw_Base.Enums
|
namespace ApiGw_Base.Enums
|
||||||
{
|
{
|
||||||
public enum ConfigurationType
|
public enum Channel
|
||||||
{
|
{
|
||||||
Web,
|
Web,
|
||||||
Mobile
|
Mobile
|
@ -1,6 +1,6 @@
|
|||||||
namespace ApiGw_Base.Enums
|
namespace ApiGw_Base.Enums
|
||||||
{
|
{
|
||||||
public enum ConfigurationBffType
|
public enum ChannelType
|
||||||
{
|
{
|
||||||
Marketing,
|
Marketing,
|
||||||
Shopping
|
Shopping
|
@ -19,7 +19,13 @@
|
|||||||
</ExeHost>
|
</ExeHost>
|
||||||
</EntryPoint>
|
</EntryPoint>
|
||||||
<EnvironmentVariables>
|
<EnvironmentVariables>
|
||||||
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value=""/>
|
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
|
||||||
|
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
|
||||||
|
<EnvironmentVariable Name="UrlMobilMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/mobile/marketing" />
|
||||||
|
<EnvironmentVariable Name="UrlMobilShopping" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/mobile/shopping" />
|
||||||
|
<EnvironmentVariable Name="UrlWebMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/web/marketing" />
|
||||||
|
<EnvironmentVariable Name="UrlWebShopping" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/web/shopping" />
|
||||||
|
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
|
||||||
</EnvironmentVariables>
|
</EnvironmentVariables>
|
||||||
</CodePackage>
|
</CodePackage>
|
||||||
|
|
||||||
|
@ -12,6 +12,12 @@
|
|||||||
<ConfigOverrides />
|
<ConfigOverrides />
|
||||||
<EnvironmentOverrides CodePackageRef="code">
|
<EnvironmentOverrides CodePackageRef="code">
|
||||||
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="[ApiGw_Base_ASPNETCORE_ENVIRONMENT]" />
|
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="[ApiGw_Base_ASPNETCORE_ENVIRONMENT]" />
|
||||||
|
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80" />
|
||||||
|
<EnvironmentVariable Name="UrlMobilMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/mobile/marketing" />
|
||||||
|
<EnvironmentVariable Name="UrlMobilShopping" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/mobile/shopping" />
|
||||||
|
<EnvironmentVariable Name="UrlWebMarketing" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/web/marketing" />
|
||||||
|
<EnvironmentVariable Name="UrlWebShopping" Value="http://apigw_base.eshoponservicefabricapigwtype:8949/configuration/web/shopping" />
|
||||||
|
<EnvironmentVariable Name="OrchestratorType" Value="SF" />
|
||||||
</EnvironmentOverrides>
|
</EnvironmentOverrides>
|
||||||
</ServiceManifestImport>
|
</ServiceManifestImport>
|
||||||
<DefaultServices>
|
<DefaultServices>
|
||||||
@ -20,7 +26,7 @@
|
|||||||
ServiceFabric PowerShell module.
|
ServiceFabric PowerShell module.
|
||||||
|
|
||||||
The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
|
The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
|
||||||
<Service Name="ApiGw_Base" ServicePackageActivationMode="ExclusiveProcess">
|
<Service Name="ApiGw_Base" ServiceDnsName="apigw_base.eshoponservicefabricapigwtype" ServicePackageActivationMode="ExclusiveProcess">
|
||||||
<StatelessService ServiceTypeName="ApiGw_BaseType" InstanceCount="[ApiGw_Base_InstanceCount]">
|
<StatelessService ServiceTypeName="ApiGw_BaseType" InstanceCount="[ApiGw_Base_InstanceCount]">
|
||||||
<SingletonPartition />
|
<SingletonPartition />
|
||||||
</StatelessService>
|
</StatelessService>
|
||||||
|
@ -8,4 +8,7 @@
|
|||||||
-->
|
-->
|
||||||
<ClusterConnectionParameters />
|
<ClusterConnectionParameters />
|
||||||
<ApplicationParameterFile Path="..\ApplicationParameters\Local.5Node.xml" />
|
<ApplicationParameterFile Path="..\ApplicationParameters\Local.5Node.xml" />
|
||||||
|
<UpgradeDeployment Mode="UnmonitoredAuto" Enabled="false">
|
||||||
|
<Parameters UpgradeReplicaSetCheckTimeoutSec="1" Force="True" />
|
||||||
|
</UpgradeDeployment>
|
||||||
</PublishProfile>
|
</PublishProfile>
|
@ -378,5 +378,4 @@ services:
|
|||||||
- OrchestratorType=${ORCHESTRATOR_TYPE}
|
- OrchestratorType=${ORCHESTRATOR_TYPE}
|
||||||
- UseLoadTest=${USE_LOADTEST:-False}
|
- UseLoadTest=${USE_LOADTEST:-False}
|
||||||
ports:
|
ports:
|
||||||
- "5100:80"
|
- "5100:80"
|
||||||
|
|
@ -303,5 +303,4 @@ services:
|
|||||||
- urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
- urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
||||||
ports:
|
ports:
|
||||||
- "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes.
|
- "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes.
|
||||||
# The API Gateway redirects and access through the internal port (80).
|
# The API Gateway redirects and access through the internal port (80).
|
||||||
|
|
@ -215,5 +215,4 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- webshoppingagg
|
- webshoppingagg
|
||||||
- webshoppingapigw
|
- webshoppingapigw
|
||||||
- webmarketingapigw
|
- webmarketingapigw
|
||||||
|
|
8
src/ApiGateways/ApiGw-Base/Enums/OrchestratorType.cs
Normal file
8
src/ApiGateways/ApiGw-Base/Enums/OrchestratorType.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace OcelotApiGw.Enums
|
||||||
|
{
|
||||||
|
public enum OrchestratorType
|
||||||
|
{
|
||||||
|
K8S,
|
||||||
|
SF
|
||||||
|
}
|
||||||
|
}
|
13
src/ApiGateways/ApiGw-Base/Models/ServiceFabricSettings.cs
Normal file
13
src/ApiGateways/ApiGw-Base/Models/ServiceFabricSettings.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace OcelotApiGw.Models
|
||||||
|
{
|
||||||
|
public class ServiceFabricSettings
|
||||||
|
{
|
||||||
|
public string UrlMobilMarketing { get; set; }
|
||||||
|
|
||||||
|
public string UrlMobilShopping { get; set; }
|
||||||
|
|
||||||
|
public string UrlWebMarketing { get; set; }
|
||||||
|
|
||||||
|
public string UrlWebShopping { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using OcelotApiGw.Enums;
|
||||||
|
|
||||||
|
namespace OcelotApiGw.Orchestrators
|
||||||
|
{
|
||||||
|
public interface IOrchestratorStrategy
|
||||||
|
{
|
||||||
|
OrchestratorType OrchestratorType { get; }
|
||||||
|
|
||||||
|
IConfigurationBuilder ConfigureOrchestrator(IConfigurationBuilder builder);
|
||||||
|
}
|
||||||
|
}
|
12
src/ApiGateways/ApiGw-Base/Orchestrators/Kubernetes.cs
Normal file
12
src/ApiGateways/ApiGw-Base/Orchestrators/Kubernetes.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using OcelotApiGw.Enums;
|
||||||
|
|
||||||
|
namespace OcelotApiGw.Orchestrators
|
||||||
|
{
|
||||||
|
public class Kubernetes : IOrchestratorStrategy
|
||||||
|
{
|
||||||
|
public OrchestratorType OrchestratorType => OrchestratorType.K8S;
|
||||||
|
|
||||||
|
public IConfigurationBuilder ConfigureOrchestrator(IConfigurationBuilder builder) => builder;
|
||||||
|
}
|
||||||
|
}
|
30
src/ApiGateways/ApiGw-Base/Orchestrators/ServiceFabric.cs
Normal file
30
src/ApiGateways/ApiGw-Base/Orchestrators/ServiceFabric.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using OcelotApiGw.Enums;
|
||||||
|
using OcelotApiGw.Providers;
|
||||||
|
using OcelotApiGw.Services;
|
||||||
|
|
||||||
|
namespace OcelotApiGw.Orchestrators
|
||||||
|
{
|
||||||
|
public class ServiceFabric : IOrchestratorStrategy
|
||||||
|
{
|
||||||
|
private readonly ISettingService _settingService;
|
||||||
|
|
||||||
|
public ServiceFabric(ISettingService settingService)
|
||||||
|
{
|
||||||
|
_settingService = settingService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrchestratorType OrchestratorType => OrchestratorType.SF;
|
||||||
|
|
||||||
|
public IConfigurationBuilder ConfigureOrchestrator(IConfigurationBuilder builder)
|
||||||
|
{
|
||||||
|
var config = _settingService.GetConfiguration();
|
||||||
|
|
||||||
|
var memoryFileProvider = new InMemoryFileProvider(config);
|
||||||
|
|
||||||
|
builder.AddJsonFile(memoryFileProvider, string.Empty, false, false);
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,7 @@
|
|||||||
using System;
|
using Microsoft.AspNetCore;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.IO;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
@ -16,24 +12,22 @@ namespace OcelotApiGw
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
BuildWebHost(args).Run();
|
WebHost.CreateDefaultBuilder(args)
|
||||||
}
|
.ConfigureAppConfiguration((hostingContext, config) =>
|
||||||
|
{
|
||||||
public static IWebHost BuildWebHost(string[] args)
|
config.SetBasePath(Directory.GetCurrentDirectory());
|
||||||
{
|
config.AddJsonFile(Path.Combine("configuration", "configuration.json"));
|
||||||
IWebHostBuilder builder = WebHost.CreateDefaultBuilder(args);
|
config.AddCommandLine(args);
|
||||||
builder.ConfigureServices(s => s.AddSingleton(builder))
|
})
|
||||||
.ConfigureAppConfiguration(ic => ic.AddJsonFile(Path.Combine("configuration", "configuration.json")))
|
|
||||||
.UseStartup<Startup>()
|
|
||||||
.UseSerilog((builderContext, config) =>
|
.UseSerilog((builderContext, config) =>
|
||||||
{
|
{
|
||||||
config
|
config
|
||||||
.MinimumLevel.Information()
|
.MinimumLevel.Information()
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.WriteTo.Console();
|
.WriteTo.Console();
|
||||||
});
|
})
|
||||||
IWebHost host = builder.Build();
|
.Build()
|
||||||
return host;
|
.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
src/ApiGateways/ApiGw-Base/Providers/InMemoryFile.cs
Normal file
28
src/ApiGateways/ApiGw-Base/Providers/InMemoryFile.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OcelotApiGw.Providers
|
||||||
|
{
|
||||||
|
public class InMemoryFile : IFileInfo
|
||||||
|
{
|
||||||
|
private readonly byte[] _data;
|
||||||
|
|
||||||
|
public InMemoryFile(string data) => _data = Encoding.UTF8.GetBytes(data);
|
||||||
|
|
||||||
|
public Stream CreateReadStream() => new MemoryStream(_data);
|
||||||
|
|
||||||
|
public bool Exists { get; } = true;
|
||||||
|
|
||||||
|
public long Length => _data.Length;
|
||||||
|
|
||||||
|
public string PhysicalPath { get; } = string.Empty;
|
||||||
|
|
||||||
|
public string Name { get; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTimeOffset LastModified { get; } = DateTimeOffset.UtcNow;
|
||||||
|
|
||||||
|
public bool IsDirectory { get; } = false;
|
||||||
|
}
|
||||||
|
}
|
18
src/ApiGateways/ApiGw-Base/Providers/InMemoryFileProvider.cs
Normal file
18
src/ApiGateways/ApiGw-Base/Providers/InMemoryFileProvider.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
|
using Microsoft.Extensions.Primitives;
|
||||||
|
|
||||||
|
namespace OcelotApiGw.Providers
|
||||||
|
{
|
||||||
|
public class InMemoryFileProvider : IFileProvider
|
||||||
|
{
|
||||||
|
private readonly IFileInfo _fileInfo;
|
||||||
|
|
||||||
|
public InMemoryFileProvider(string data) => _fileInfo = new InMemoryFile(data);
|
||||||
|
|
||||||
|
public IFileInfo GetFileInfo(string subpath) => _fileInfo;
|
||||||
|
|
||||||
|
public IDirectoryContents GetDirectoryContents(string subpath) => null;
|
||||||
|
|
||||||
|
public IChangeToken Watch(string filter) => NullChangeToken.Singleton;
|
||||||
|
}
|
||||||
|
}
|
7
src/ApiGateways/ApiGw-Base/Services/ISettingService.cs
Normal file
7
src/ApiGateways/ApiGw-Base/Services/ISettingService.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace OcelotApiGw.Services
|
||||||
|
{
|
||||||
|
public interface ISettingService
|
||||||
|
{
|
||||||
|
string GetConfiguration();
|
||||||
|
}
|
||||||
|
}
|
51
src/ApiGateways/ApiGw-Base/Services/SettingService.cs
Normal file
51
src/ApiGateways/ApiGw-Base/Services/SettingService.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using OcelotApiGw.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OcelotApiGw.Services
|
||||||
|
{
|
||||||
|
public class SettingService : ISettingService
|
||||||
|
{
|
||||||
|
private readonly HttpClient _httpClient;
|
||||||
|
private readonly ServiceFabricSettings _serviceFabricSettings;
|
||||||
|
|
||||||
|
public SettingService(HttpClient httpClient, IOptions<ServiceFabricSettings> serviceFabricSettings)
|
||||||
|
{
|
||||||
|
_httpClient = httpClient;
|
||||||
|
_serviceFabricSettings = serviceFabricSettings.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetConfiguration()
|
||||||
|
{
|
||||||
|
var strings = new List<string>();
|
||||||
|
|
||||||
|
var tasks = new Func<Task>[]
|
||||||
|
{
|
||||||
|
async () => {
|
||||||
|
var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlMobilMarketing);
|
||||||
|
strings.Add(configuration);
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlMobilShopping);
|
||||||
|
strings.Add(configuration);
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlWebMarketing);
|
||||||
|
strings.Add(configuration);
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
var configuration = await _httpClient.GetStringAsync(_serviceFabricSettings.UrlWebShopping);
|
||||||
|
strings.Add(configuration);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Task.WaitAll(tasks.Select(task => task()).ToArray());
|
||||||
|
|
||||||
|
return string.Join(',', strings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,84 +1,90 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using HealthChecks.UI.Client;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Ocelot.DependencyInjection;
|
using Ocelot.DependencyInjection;
|
||||||
using Ocelot.Middleware;
|
using Ocelot.Middleware;
|
||||||
|
using OcelotApiGw.Enums;
|
||||||
|
using OcelotApiGw.Models;
|
||||||
|
using OcelotApiGw.Orchestrators;
|
||||||
|
using OcelotApiGw.Providers;
|
||||||
|
using OcelotApiGw.Services;
|
||||||
using System;
|
using System;
|
||||||
using HealthChecks.UI.Client;
|
using System.Linq;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
|
||||||
|
|
||||||
namespace OcelotApiGw
|
namespace OcelotApiGw
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
private readonly IConfiguration _cfg;
|
private IConfiguration _configuration;
|
||||||
|
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_cfg = configuration;
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
var identityUrl = _cfg.GetValue<string>("IdentityUrl");
|
var identityUrl = _configuration.GetValue<string>("IdentityUrl");
|
||||||
var authenticationProviderKey = "IdentityApiKey";
|
var authenticationProviderKey = "IdentityApiKey";
|
||||||
|
|
||||||
services.AddHealthChecks()
|
services.AddHealthChecks()
|
||||||
.AddCheck("self", () => HealthCheckResult.Healthy())
|
.AddCheck("self", () => HealthCheckResult.Healthy())
|
||||||
.AddUrlGroup(new Uri(_cfg["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" })
|
.AddUrlGroup(new Uri(_configuration["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" })
|
||||||
.AddUrlGroup(new Uri(_cfg["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" })
|
.AddUrlGroup(new Uri(_configuration["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" })
|
||||||
.AddUrlGroup(new Uri(_cfg["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
|
.AddUrlGroup(new Uri(_configuration["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" })
|
||||||
.AddUrlGroup(new Uri(_cfg["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
|
.AddUrlGroup(new Uri(_configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" })
|
||||||
.AddUrlGroup(new Uri(_cfg["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" })
|
.AddUrlGroup(new Uri(_configuration["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" })
|
||||||
.AddUrlGroup(new Uri(_cfg["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
|
.AddUrlGroup(new Uri(_configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
|
||||||
.AddUrlGroup(new Uri(_cfg["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
|
.AddUrlGroup(new Uri(_configuration["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
|
||||||
|
|
||||||
services.AddCors(options =>
|
services.AddCors(options =>
|
||||||
{
|
{
|
||||||
options.AddPolicy("CorsPolicy",
|
options.AddPolicy("CorsPolicy", builder =>
|
||||||
builder => builder
|
builder.AllowAnyOrigin()
|
||||||
.AllowAnyMethod()
|
.AllowAnyMethod()
|
||||||
.AllowAnyHeader()
|
.AllowAnyHeader()
|
||||||
.SetIsOriginAllowed((host) => true)
|
.AllowCredentials());
|
||||||
.AllowCredentials());
|
})
|
||||||
|
.AddTransient<IOrchestratorStrategy, Kubernetes>()
|
||||||
|
.AddTransient<IOrchestratorStrategy, ServiceFabric>()
|
||||||
|
.AddTransient<IFileProvider, InMemoryFileProvider>()
|
||||||
|
.AddAuthentication()
|
||||||
|
.AddJwtBearer(authenticationProviderKey, options =>
|
||||||
|
{
|
||||||
|
options.Authority = identityUrl;
|
||||||
|
options.RequireHttpsMetadata = false;
|
||||||
|
options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
|
||||||
|
{
|
||||||
|
ValidAudiences = new[] { "orders", "basket", "locations", "marketing", "mobileshoppingagg", "webshoppingagg" }
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddAuthentication()
|
services.Configure<ServiceFabricSettings>(_configuration);
|
||||||
.AddJwtBearer(authenticationProviderKey, x =>
|
services.AddHttpClient<ISettingService, SettingService>();
|
||||||
{
|
|
||||||
x.Authority = identityUrl;
|
|
||||||
x.RequireHttpsMetadata = false;
|
|
||||||
x.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
|
|
||||||
{
|
|
||||||
ValidAudiences = new[] { "orders", "basket", "locations", "marketing", "mobileshoppingagg", "webshoppingagg" }
|
|
||||||
};
|
|
||||||
x.Events = new Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents()
|
|
||||||
{
|
|
||||||
OnAuthenticationFailed = async ctx =>
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
},
|
|
||||||
OnTokenValidated = async ctx =>
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
OnMessageReceived = async ctx =>
|
var orchestratorType = _configuration.GetValue<OrchestratorType>("OrchestratorType");
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
services.AddOcelot(_cfg);
|
var config = new ConfigurationBuilder()
|
||||||
|
.AddConfiguration(_configuration);
|
||||||
|
|
||||||
|
_configuration = services.BuildServiceProvider()
|
||||||
|
.GetServices<IOrchestratorStrategy>()
|
||||||
|
.Single(strategy => strategy.OrchestratorType == orchestratorType)
|
||||||
|
.ConfigureOrchestrator(config)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
services.AddOcelot(_configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
var pathBase = _cfg["PATH_BASE"];
|
var pathBase = _configuration.GetValue<string>("PATH_BASE");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(pathBase))
|
if (!string.IsNullOrEmpty(pathBase))
|
||||||
{
|
{
|
||||||
@ -101,11 +107,13 @@ namespace OcelotApiGw
|
|||||||
Predicate = r => r.Name.Contains("self")
|
Predicate = r => r.Name.Contains("self")
|
||||||
});
|
});
|
||||||
|
|
||||||
loggerFactory.AddConsole(_cfg.GetSection("Logging"));
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
loggerFactory.AddConsole(_configuration.GetSection("Logging"));
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
|
||||||
app.UseCors("CorsPolicy");
|
app.UseCors("CorsPolicy")
|
||||||
|
.UseOcelot()
|
||||||
app.UseOcelot().Wait();
|
.Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
|
||||||
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.1.0" />
|
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.1.0" />
|
||||||
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.1.1" />
|
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="0.3.3" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="2.2.0-preview2-35157" />
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="1.0.163" />
|
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="1.0.163" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -27,4 +27,9 @@
|
|||||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user