Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
Set DAPR_HTTP_PORT when launching project
Browse files Browse the repository at this point in the history
Fixes: #575

Tye was missing code to set DAPR_HTTP_PORT when launching a project.
This variable is normally set by dapr when using `dapr run ...` to
launch a project. However Tye doesn't use `dapr run ...` so we need to
emulate this behavior.

We already had code to set up DAPR_GRPC_PORT which is used by the
`DaprClient` class. DAPR_HTTP_PORT is used by the actor runtime in
addition to behing available for arbitrary use (as reported in the
issue).
  • Loading branch information
rynowak committed Oct 12, 2020
1 parent 45ffa3c commit 5c014b6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Microsoft.Tye.Extensions/Dapr/DaprExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public override Task ProcessAsync(ExtensionContext context, ExtensionConfigurati
};
project.EnvironmentVariables.Add(daprGrpcPort);

// Set DAPR_Http_PORT based on this service's assigned port
// Set DAPR_HTTP_PORT based on this service's assigned port
var daprHttpPort = new EnvironmentVariableBuilder("DAPR_HTTP_PORT")
{
Source = new EnvironmentVariableSourceBuilder(proxy.Name, binding: "http")
Expand All @@ -149,6 +149,16 @@ public override Task ProcessAsync(ExtensionContext context, ExtensionConfigurati
};
proxy.EnvironmentVariables.Add(daprHttpPort);

// Add another copy of this envvar to the project.
daprHttpPort = new EnvironmentVariableBuilder("DAPR_HTTP_PORT")
{
Source = new EnvironmentVariableSourceBuilder(proxy.Name, binding: "http")
{
Kind = EnvironmentVariableSourceBuilder.SourceKind.Port,
},
};
project.EnvironmentVariables.Add(daprHttpPort);

// Set METRICS_PORT to a random port
var metricsPort = new EnvironmentVariableBuilder("METRICS_PORT")
{
Expand Down

0 comments on commit 5c014b6

Please sign in to comment.