forked from testcontainers/testcontainers-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemporalContainer.cs
More file actions
45 lines (42 loc) · 1.56 KB
/
TemporalContainer.cs
File metadata and controls
45 lines (42 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
namespace Testcontainers.Temporal;
/// <inheritdoc cref="DockerContainer" />
[PublicAPI]
public sealed class TemporalContainer : DockerContainer
{
/// <summary>
/// Initializes a new instance of the <see cref="TemporalContainer" /> class.
/// </summary>
/// <param name="configuration">The container configuration.</param>
public TemporalContainer(TemporalConfiguration configuration)
: base(configuration)
{
}
/// <summary>
/// Gets the Temporal gRPC address.
/// </summary>
/// <remarks>
/// The Temporal SDK (client library) expects <c>host:port</c> without a scheme.
/// </remarks>
/// <example>
/// <code>
/// var clientOptions = new TemporalClientConnectOptions();
/// clientOptions.TargetHost = temporalContainer.GetGrpcAddress();
/// <br />
/// var connectedClient = await TemporalClient.ConnectAsync(clientOptions);
/// </code>
/// </example>
/// <seealso href="https://github.com/temporalio/sdk-dotnet?tab=readme-ov-file#running-a-worker" />
/// <returns>The Temporal gRPC address in <c>host:port</c> format.</returns>
public string GetGrpcAddress()
{
return Hostname + ":" + GetMappedPublicPort(TemporalBuilder.TemporalGrpcPort);
}
/// <summary>
/// Gets the Temporal Web UI address.
/// </summary>
/// <returns>The Temporal Web UI base address.</returns>
public string GetWebUiAddress()
{
return new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(TemporalBuilder.TemporalHttpPort)).ToString();
}
}