diff --git a/ServiceFabric/Linux/.dockerignore b/ServiceFabric/Linux/.dockerignore new file mode 100644 index 000000000..df2e0fe50 --- /dev/null +++ b/ServiceFabric/Linux/.dockerignore @@ -0,0 +1,9 @@ +.dockerignore +.env +.git +.gitignore +.vs +.vscode +*/bin +*/obj +**/.toolstarget \ No newline at end of file diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj index d0ca885ee..f7182778f 100644 --- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj +++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/ApiGw_Base.csproj @@ -6,6 +6,8 @@ True win7-x64 False + Linux + 860c6d00-8a17-45b6-be76-28c2395d468e @@ -16,6 +18,7 @@ + diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml index ad84ffd8a..aaaba1127 100644 --- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml +++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/Config/Settings.xml @@ -1,9 +1,10 @@  - + diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml index 3538961fa..86a02a3bc 100644 --- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml +++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/PackageRoot/ServiceManifest.xml @@ -17,9 +17,18 @@ ApiGw_Base.exe CodePackage + - + + + + + + + @@ -32,6 +41,7 @@ + diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json index a4095d193..f0d583199 100644 --- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json +++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/ApiGw_Base/Properties/launchSettings.json @@ -1,13 +1,13 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", +{ "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, + "windowsAuthentication": false, + "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:51647", "sslPort": 44363 } }, + "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { "IIS Express": { "commandName": "IISExpress", @@ -21,10 +21,15 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "api/values", - "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values" } } } \ No newline at end of file diff --git a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml index 37a0974bf..3673aa6c5 100644 --- a/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml +++ b/ServiceFabric/Linux/eShopOnServiceFabricApiGateWays/eShopOnServiceFabricApiGW/ApplicationPackageRoot/ApplicationManifest.xml @@ -13,6 +13,11 @@ + - + diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 969cfb922..7746bf6b2 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -313,5 +313,4 @@ services: - OrchestratorType=${ORCHESTRATOR_TYPE} - UseLoadTest=${USE_LOADTEST:-False} ports: - - "5100:80" - + - "5100:80" \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 4bf465565..f9a15adf2 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -303,5 +303,4 @@ services: - urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. ports: - "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). \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 95610ebd5..6e39af415 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -215,5 +215,4 @@ services: depends_on: - webshoppingagg - webshoppingapigw - - webmarketingapigw - + - webmarketingapigw \ No newline at end of file diff --git a/src/ApiGateways/ApiGw-Base/Program.cs b/src/ApiGateways/ApiGw-Base/Program.cs index e5116998b..b6a92c318 100644 --- a/src/ApiGateways/ApiGw-Base/Program.cs +++ b/src/ApiGateways/ApiGw-Base/Program.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using System.IO; namespace OcelotApiGw { @@ -7,12 +9,16 @@ namespace OcelotApiGw { public static void Main(string[] args) { - BuildWebHost(args).Run(); - } - - public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) + .ConfigureAppConfiguration((hostingContext, config) => + { + config.SetBasePath(Directory.GetCurrentDirectory()); + config.AddJsonFile(Path.Combine("configuration", "configuration.json")); + config.AddCommandLine(args); + }) .UseStartup() - .Build(); + .Build() + .Run(); + } } } diff --git a/src/ApiGateways/ApiGw-Base/Services/SettingService.cs b/src/ApiGateways/ApiGw-Base/Services/SettingService.cs index 88eb89349..11ba2a561 100644 --- a/src/ApiGateways/ApiGw-Base/Services/SettingService.cs +++ b/src/ApiGateways/ApiGw-Base/Services/SettingService.cs @@ -45,7 +45,7 @@ namespace OcelotApiGw.Services Task.WaitAll(tasks.Select(task => task()).ToArray()); - return string.Concat(strings); + return string.Join(',', strings); } } } diff --git a/src/ApiGateways/ApiGw-Base/Startup.cs b/src/ApiGateways/ApiGw-Base/Startup.cs index 5e700817c..f112cbffd 100644 --- a/src/ApiGateways/ApiGw-Base/Startup.cs +++ b/src/ApiGateways/ApiGw-Base/Startup.cs @@ -17,7 +17,7 @@ namespace OcelotApiGw { public class Startup { - private readonly IConfiguration _configuration; + private IConfiguration _configuration; public Startup(IConfiguration configuration) { @@ -59,13 +59,13 @@ namespace OcelotApiGw var config = new ConfigurationBuilder() .AddConfiguration(_configuration); - var cfg = services.BuildServiceProvider() + _configuration = services.BuildServiceProvider() .GetServices() .Single(strategy => strategy.OrchestratorType == orchestratorType) .ConfigureOrchestrator(config) .Build(); - services.AddOcelot(cfg); + services.AddOcelot(_configuration); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)