-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Warning ASPIRE002: AppHost is an Aspire AppHost project but necessary dependencies aren't present. Are you missing an Aspire.Hosting PackageReference? * Update to preview 5
- Loading branch information
1 parent
0f62425
commit c06b999
Showing
10 changed files
with
43 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 15 additions & 7 deletions
22
src/InfinityFlow.Aspire.Temporal/TemporalServerExecutableResource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
using InfinityFlow.Aspire.Temporal; | ||
using Aspire.Hosting.ApplicationModel; | ||
|
||
|
||
namespace Aspire.Hosting; | ||
|
||
public class TemporalServerExecutableResource(string name, TemporalServerResourceArguments arguments) : ExecutableResource(name, command: "temporal", workingDirectory: "", args: arguments.GetArgs()), IResourceWithConnectionString | ||
public class TemporalServerExecutableResource(string name, TemporalServerResourceArguments arguments) : ExecutableResource(name, command: "temporal", workingDirectory: ""), IResourceWithConnectionString | ||
Check warning on line 7 in src/InfinityFlow.Aspire.Temporal/TemporalServerExecutableResource.cs
|
||
{ | ||
public ReferenceExpression ConnectionStringExpression => ReferenceExpression.Create($"{GetConnectionString()}"); | ||
|
||
public string? GetConnectionString() | ||
{ | ||
if (!this.TryGetAllocatedEndPoints(out var endpoints)) | ||
var endpoints = this.GetEndpoints().Where(e => e.IsAllocated).ToList(); | ||
if (endpoints.Count==0) | ||
{ | ||
throw new DistributedApplicationException("Expected allocated endpoints!"); | ||
} | ||
|
||
var server = endpoints.Single(x => x.Name == "server"); | ||
var server = endpoints.SingleOrDefault(x => x.EndpointName == "server"); | ||
|
||
return server.EndPointString; | ||
return $"{server?.Host}:{server?.Port}"; | ||
} | ||
} | ||
|
||
public class TemporalServerContainerResource(string name, TemporalServerResourceArguments arguments) : ContainerResource(name,entrypoint: "/temporal"), IResourceWithConnectionString, IResourceWithEnvironment | ||
{ | ||
public ReferenceExpression ConnectionStringExpression => ReferenceExpression.Create($"{GetConnectionString()}"); | ||
|
||
public TemporalServerResourceArguments Arguments { get; } = arguments; | ||
|
||
public string? GetConnectionString() | ||
{ | ||
if (!this.TryGetAllocatedEndPoints(out var endpoints)) | ||
var endpoints = this.GetEndpoints().Where(e => e.IsAllocated).ToList(); | ||
if (endpoints.Count == 0) | ||
{ | ||
throw new DistributedApplicationException("Expected allocated endpoints!"); | ||
} | ||
|
||
var server = endpoints.Single(x => x.Name == "server"); | ||
var server = endpoints.SingleOrDefault(x => x.EndpointName == "server"); | ||
|
||
return server.EndPointString; | ||
return $"{server?.Host}:{server?.Port}"; | ||
} | ||
} |