Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ services:
P2: "${PARAM2}"
P3: "${PARAM3}"
services__api__http__0: "http://api:8005"
services__api__https__0: "https://api:8007"
ports:
- "8011:8010"
- "8013:8012"
Expand Down
19 changes: 19 additions & 0 deletions src/Aspire.Hosting.Docker/DockerComposePublishingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ private async Task ProcessEnvironmentAsync(DistributedApplicationExecutionContex
await c.Callback(context).ConfigureAwait(false);
}

RemoveHttpsServiceDiscoveryVariables(context.EnvironmentVariables);

foreach (var kv in context.EnvironmentVariables)
{
var value = await ProcessValueAsync(kv.Value).ConfigureAwait(false);
Expand All @@ -329,6 +331,23 @@ private async Task ProcessEnvironmentAsync(DistributedApplicationExecutionContex
}
}
}

private static void RemoveHttpsServiceDiscoveryVariables(Dictionary<string, object> environmentVariables)
{
// HACK: At the moment Docker Compose doesn't do anything with setting up certificates so
// we need to remove the https service discovery variables.

var keysToRemove = environmentVariables
.Where(kvp => kvp.Value is EndpointReference epRef && epRef.Scheme == "https" && kvp.Key.StartsWith("services__"))
.Select(kvp => kvp.Key)
.ToList();

foreach (var key in keysToRemove)
{
environmentVariables.Remove(key);
}
}

private void ProcessVolumes()
{
if (!resource.TryGetContainerMounts(out var mounts))
Expand Down
Loading