Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public static IResourceBuilder<MySqlServerResource> AddMySql(this IDistributedAp
});

var healthCheckKey = $"{name}_check";
builder.Services.AddHealthChecks().AddMySql(sp => connectionString ?? throw new InvalidOperationException("Connection string is unavailable"), name: healthCheckKey);
builder.Services.AddHealthChecks().AddMySql(
sp => (connectionString ?? throw new InvalidOperationException("Connection string is unavailable")) + ";Connect Timeout=30;AllowPublicKeyRetrieval=true",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot clean this code up a bit now so we have a method body to the callback, check that the connection string is null and then return the appended value. Also we probably don't need AllowPublicKeyRetrieval=true.

name: healthCheckKey);

return builder.AddResource(resource)
.WithEndpoint(port: port, targetPort: 3306, name: MySqlServerResource.PrimaryEndpointName) // Internal port is always 3306.
Expand Down
4 changes: 3 additions & 1 deletion src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public static IResourceBuilder<RedisResource> AddRedis(
});

var healthCheckKey = $"{name}_check";
builder.Services.AddHealthChecks().AddRedis(sp => connectionString ?? throw new InvalidOperationException("Connection string is unavailable"), name: healthCheckKey);
builder.Services.AddHealthChecks().AddRedis(
sp => (connectionString ?? throw new InvalidOperationException("Connection string is unavailable")) + ",abortConnect=false",
name: healthCheckKey);

return builder.AddResource(redis)
.WithEndpoint(port: port, targetPort: 6379, name: RedisResource.PrimaryEndpointName)
Expand Down
Loading