namespace TriunniaLabs.Arch.Sample.Aspire.AppHost
{
internal static class TokensApiSetup
{
///
/// Adds a resource for the Tokens Api on port 50003.
///
/// Reference to the application builder.
/// Reference to the Sql Server resource.
public static void AddTokensApi(this IDistributedApplicationBuilder builder, IResourceBuilder sqlServer)
{
var tokensApiDb = sqlServer.AddDatabase("TokensApiDb");
builder.AddContainer("TokensApi", "gitea.triunnialabs.com/triunnialabs/arch-tokens-api", "0.3.2")
.WithEndpoint(50003, 8080, isProxied: false, name: "http")
.WithEndpoint("http", e => e.TargetHost = "0.0.0.0")
// Obtain the values for these fields from the Control Panel
.WithEnvironment("Microservice__Name", "")
.WithEnvironment("Microservice__EnvelopePassword", "")
.WithEnvironment("Microservice__EnableDiagnostics", "true") // Set to false in production deployments
.WithEnvironment("Microservice__Application__Url", "")
.WithEnvironment("Microservice__Application__ApplicationId", "")
.WithEnvironment("Microservice__Application__ApiKey", "")
.WithEnvironment("Microservice__Application__EnvelopePassword", "")
.WithEnvironment("Microservice__ProtectedMemory__HmacSha512HashKey", "")
.WithEnvironment("Microservice__ProtectedMemory__AesEncryptionPassword", "")
.WithEnvironment("Microservice__ProtectedMemory__AesEncryptionSalt", "")
.WithEnvironment("Microservice__ProtectedMemory__AesEncryptionIterations", "")
.WithEnvironment("SqlServer__ConnectionString", "")
.WithEnvironment("SqlServer__ReadOnlyConnectionString", "")
// Api will write log and other files to this relatiove source folder
.WithBindMount("..\\..\\..\\data\\TokensApi", "/opt/triunnialabs/arch/tokens-api")
.WithReference(tokensApiDb)
.WaitFor(tokensApiDb);
}
}
}