From 2057e764e766122320a95292dfaa76cbf47ae2d0 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 24 Aug 2021 13:14:15 +0200 Subject: [PATCH] [SPA] Add support for a port range on the SPA proxy (#12) Adds support for using a port range on Kestrel and the front-end SPA proxy --- .../.template.config/dotnetcli.host.json | 10 +- .../.template.config/template.json | 91 ++++++++++++++++--- .../.template.config/dotnetcli.host.json | 10 +- .../.template.config/template.json | 90 +++++++++++++++--- 4 files changed, 173 insertions(+), 28 deletions(-) diff --git a/src/content/Angular-CSharp/.template.config/dotnetcli.host.json b/src/content/Angular-CSharp/.template.config/dotnetcli.host.json index 1a247d9..63792e4 100644 --- a/src/content/Angular-CSharp/.template.config/dotnetcli.host.json +++ b/src/content/Angular-CSharp/.template.config/dotnetcli.host.json @@ -7,10 +7,16 @@ "Framework": { "longName": "framework" }, - "HttpPort": { + "kestrelHttpPort": { "isHidden": true }, - "HttpsPort": { + "kestrelHttpsPort": { + "isHidden": true + }, + "iisHttpPort": { + "isHidden": true + }, + "iisHttpsPort": { "isHidden": true }, "ExcludeLaunchSettings": { diff --git a/src/content/Angular-CSharp/.template.config/template.json b/src/content/Angular-CSharp/.template.config/template.json index 1302b3f..94d7e28 100644 --- a/src/content/Angular-CSharp/.template.config/template.json +++ b/src/content/Angular-CSharp/.template.config/template.json @@ -113,30 +113,75 @@ "description": "If specified, skips the automatic restore of the project on create.", "defaultValue": "false" }, - "HttpPort": { + + "kestrelHttpPort": { "type": "parameter", "datatype": "integer", "description": "Port number to use for the HTTP endpoint in launchSettings.json." }, - "HttpPortGenerated": { + "kestrelHttpPortGenerated": { "type": "generated", - "generator": "port" + "generator": "port", + "parameters": { + "low": 5000, + "high": 5300 + } }, - "HttpPortReplacer": { + "kestrelHttpPortReplacer": { "type": "generated", "generator": "coalesce", "parameters": { - "sourceVariableName": "HttpPort", - "fallbackVariableName": "HttpPortGenerated" + "sourceVariableName": "kestrelHttpPort", + "fallbackVariableName": "kestrelHttpPortGenerated" + }, + "replaces": "5000" + }, + "kestrelHttpsPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)." + }, + "kestrelHttpsPortGenerated": { + "type": "generated", + "generator": "port", + "parameters": { + "low": 7000, + "high": 7300 + } + }, + "kestrelHttpsPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "kestrelHttpsPort", + "fallbackVariableName": "kestrelHttpsPortGenerated" + }, + "replaces": "5001" + }, + "iisHttpPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json." + }, + "iisHttpPortGenerated": { + "type": "generated", + "generator": "port" + }, + "iisHttpPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "iisHttpPort", + "fallbackVariableName": "iisHttpPortGenerated" }, "replaces": "8080" }, - "HttpsPort": { + "iisHttpsPort": { "type": "parameter", "datatype": "integer", - "description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if IndividualLocalAuth is used)." + "description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)." }, - "HttpsPortGenerated": { + "iisHttpsPortGenerated": { "type": "generated", "generator": "port", "parameters": { @@ -144,15 +189,37 @@ "high": 44399 } }, - "HttpsPortReplacer": { + "iisHttpsPortReplacer": { "type": "generated", "generator": "coalesce", "parameters": { - "sourceVariableName": "HttpsPort", - "fallbackVariableName": "HttpsPortGenerated" + "sourceVariableName": "iisHttpsPort", + "fallbackVariableName": "iisHttpsPortGenerated" }, "replaces": "44300" }, + "ProxyPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the SPA front-end development proxy." + }, + "ProxyPortGenerated": { + "type": "generated", + "generator": "port", + "parameters": { + "low": 44400, + "high": 44499 + } + }, + "ProxyPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "ProxyPort", + "fallbackVariableName": "ProxyPortGenerated" + }, + "replaces": "5002" + }, "IndividualLocalAuth": { "type": "computed", "value": "(auth == \"Individual\")" diff --git a/src/content/React-CSharp/.template.config/dotnetcli.host.json b/src/content/React-CSharp/.template.config/dotnetcli.host.json index 1a247d9..63792e4 100644 --- a/src/content/React-CSharp/.template.config/dotnetcli.host.json +++ b/src/content/React-CSharp/.template.config/dotnetcli.host.json @@ -7,10 +7,16 @@ "Framework": { "longName": "framework" }, - "HttpPort": { + "kestrelHttpPort": { "isHidden": true }, - "HttpsPort": { + "kestrelHttpsPort": { + "isHidden": true + }, + "iisHttpPort": { + "isHidden": true + }, + "iisHttpsPort": { "isHidden": true }, "ExcludeLaunchSettings": { diff --git a/src/content/React-CSharp/.template.config/template.json b/src/content/React-CSharp/.template.config/template.json index 0d47ffb..5fcab90 100644 --- a/src/content/React-CSharp/.template.config/template.json +++ b/src/content/React-CSharp/.template.config/template.json @@ -115,30 +115,74 @@ "description": "If specified, skips the automatic restore of the project on create.", "defaultValue": "false" }, - "HttpPort": { + "kestrelHttpPort": { "type": "parameter", "datatype": "integer", "description": "Port number to use for the HTTP endpoint in launchSettings.json." }, - "HttpPortGenerated": { + "kestrelHttpPortGenerated": { "type": "generated", - "generator": "port" + "generator": "port", + "parameters": { + "low": 5000, + "high": 5300 + } }, - "HttpPortReplacer": { + "kestrelHttpPortReplacer": { "type": "generated", "generator": "coalesce", "parameters": { - "sourceVariableName": "HttpPort", - "fallbackVariableName": "HttpPortGenerated" + "sourceVariableName": "kestrelHttpPort", + "fallbackVariableName": "kestrelHttpPortGenerated" + }, + "replaces": "5000" + }, + "kestrelHttpsPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)." + }, + "kestrelHttpsPortGenerated": { + "type": "generated", + "generator": "port", + "parameters": { + "low": 7000, + "high": 7300 + } + }, + "kestrelHttpsPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "kestrelHttpsPort", + "fallbackVariableName": "kestrelHttpsPortGenerated" + }, + "replaces": "5001" + }, + "iisHttpPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the IIS Express HTTP endpoint in launchSettings.json." + }, + "iisHttpPortGenerated": { + "type": "generated", + "generator": "port" + }, + "iisHttpPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "iisHttpPort", + "fallbackVariableName": "iisHttpPortGenerated" }, "replaces": "8080" }, - "HttpsPort": { + "iisHttpsPort": { "type": "parameter", "datatype": "integer", - "description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if IndividualLocalAuth is used)." + "description": "Port number to use for the IIS Express HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)." }, - "HttpsPortGenerated": { + "iisHttpsPortGenerated": { "type": "generated", "generator": "port", "parameters": { @@ -146,15 +190,37 @@ "high": 44399 } }, - "HttpsPortReplacer": { + "iisHttpsPortReplacer": { "type": "generated", "generator": "coalesce", "parameters": { - "sourceVariableName": "HttpsPort", - "fallbackVariableName": "HttpsPortGenerated" + "sourceVariableName": "iisHttpsPort", + "fallbackVariableName": "iisHttpsPortGenerated" }, "replaces": "44300" }, + "ProxyPort": { + "type": "parameter", + "datatype": "integer", + "description": "Port number to use for the SPA front-end development proxy." + }, + "ProxyPortGenerated": { + "type": "generated", + "generator": "port", + "parameters": { + "low": 44400, + "high": 44499 + } + }, + "ProxyPortReplacer": { + "type": "generated", + "generator": "coalesce", + "parameters": { + "sourceVariableName": "ProxyPort", + "fallbackVariableName": "ProxyPortGenerated" + }, + "replaces": "5002" + }, "IndividualLocalAuth": { "type": "computed", "value": "(auth == \"Individual\")"