Skip to content

Commit 56db39e

Browse files
committed
Make LOCALSTACK_HOST static
1 parent 0f95db9 commit 56db39e

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/Aspire.Hosting.LocalStack/Internal/LocalStackConnectionStringAvailableCallback.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Globalization;
2-
using Aspire.Hosting.ApplicationModel;
1+
using Aspire.Hosting.ApplicationModel;
32
using Aspire.Hosting.AWS.CloudFormation;
43
using Aspire.Hosting.LocalStack.Annotations;
54

@@ -38,9 +37,6 @@ internal static Func<ILocalStackResource, ConnectionStringAvailableEvent, Cancel
3837

3938
var localStackUrl = new Uri(connectionString);
4039

41-
var resourceBuilder = builder.CreateResourceBuilder(localStackResource);
42-
resourceBuilder.WithEnvironment("LOCALSTACK_HOST", $"{localStackUrl.Host}:{localStackUrl.Port.ToString(CultureInfo.InvariantCulture)}");
43-
4440
var referencedResources = localStackResource.Annotations.OfType<LocalStackReferenceAnnotation>();
4541
foreach (var resource in referencedResources.Select(annotation => annotation.Resource))
4642
{

src/Aspire.Hosting.LocalStack/LocalStackResourceBuilderExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ public static IDistributedApplicationBuilder UseLocalStack(this IDistributedAppl
176176
.WithEnvironment("DEBUG", containerOptions.DebugLevel.ToString(CultureInfo.InvariantCulture))
177177
.WithEnvironment("LS_LOG", containerOptions.LogLevel.ToEnvironmentValue())
178178
.WithEnvironment("DOCKER_HOST", "unix:///var/run/docker.sock")
179+
.WithEnvironment("LOCALSTACK_HOST", $"localhost:{Constants.DefaultContainerPort.ToString(CultureInfo.InvariantCulture)}")
179180
.WithExternalHttpEndpoints()
180181
.ExcludeFromManifest(); // LocalStack is for local development only
181182

0 commit comments

Comments
 (0)