Skip to content

Commit

Permalink
优化网关代码
Browse files Browse the repository at this point in the history
  • Loading branch information
zhontai committed Jan 6, 2025
1 parent e42d843 commit 4aed5b3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
4 changes: 1 addition & 3 deletions src/gateways/ZhonTai.Gateway.Yarp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
app.MapGet("/", async (HttpResponse response) =>
{
var gatewayConfig = builder.Configuration.GetSection("GatewayConfig").Get<GatewayConfig>();

var moduleList = gatewayConfig.ModuleList;
var moduleList = gatewayConfig?.ModuleList;

var html = $"<html><body>";
if (moduleList?.Count > 0)
Expand All @@ -65,7 +64,6 @@
html += "</body></html>";

response.ContentType = "text/html;charset=UTF-8";

await response.WriteAsync(html);
});

Expand Down
4 changes: 1 addition & 3 deletions templates/gateway/content/MyGateway.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
app.MapGet("/", async (HttpResponse response) =>
{
var gatewayConfig = builder.Configuration.GetSection("GatewayConfig").Get<GatewayConfig>();

var moduleList = gatewayConfig.ModuleList;
var moduleList = gatewayConfig?.ModuleList;

var html = $"<html><body>";
if (moduleList?.Count > 0)
Expand All @@ -65,7 +64,6 @@
html += "</body></html>";

response.ContentType = "text/html;charset=UTF-8";

await response.WriteAsync(html);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"environmentVariables": {
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": false
}
},
"$schema": "https://json.schemastore.org/launchsettings.json",
Expand Down

0 comments on commit 4aed5b3

Please sign in to comment.