mirror of
https://github.com/fiodarsazanavets/aspire-13-examples.git
synced 2026-06-20 12:23:14 +00:00
Add Oracle integration
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace OnlineShop.MailDev.Hosting;
|
||||
|
||||
internal static class MailDevContainerImageTags
|
||||
{
|
||||
internal const string Registry = "docker.io";
|
||||
|
||||
internal const string Image = "maildev/maildev";
|
||||
|
||||
internal const string Tag = "2.1.0";
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Aspire.Hosting.ApplicationModel;
|
||||
|
||||
namespace OnlineShop.MailDev.Hosting;
|
||||
|
||||
public sealed class MailDevResource(string name) :
|
||||
ContainerResource(name), IResourceWithConnectionString
|
||||
{
|
||||
internal const string SmtpEndpointName = "smtp";
|
||||
internal const string HttpEndpointName = "http";
|
||||
|
||||
private EndpointReference? _smtpReference;
|
||||
|
||||
public EndpointReference SmtpEndpoint =>
|
||||
_smtpReference ??= new(this, SmtpEndpointName);
|
||||
|
||||
public ReferenceExpression ConnectionStringExpression =>
|
||||
ReferenceExpression.Create(
|
||||
$"smtp://{SmtpEndpoint.Property(EndpointProperty.Host)}:{SmtpEndpoint.Property(EndpointProperty.Port)}"
|
||||
);
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
using Aspire.Hosting;
|
||||
using Aspire.Hosting.ApplicationModel;
|
||||
|
||||
namespace OnlineShop.MailDev.Hosting;
|
||||
|
||||
public static class MailDevResourceBuilderExtensions
|
||||
{
|
||||
public static IResourceBuilder<MailDevResource> AddMailDev(
|
||||
this IDistributedApplicationBuilder builder,
|
||||
string name,
|
||||
int? httpPort = null,
|
||||
int? smtpPort = null)
|
||||
{
|
||||
MailDevResource resource = new(name);
|
||||
|
||||
return builder.AddResource(resource)
|
||||
.WithImage(MailDevContainerImageTags.Image)
|
||||
.WithImageRegistry(MailDevContainerImageTags.Registry)
|
||||
.WithImageTag(MailDevContainerImageTags.Tag)
|
||||
.WithHttpEndpoint(
|
||||
targetPort: 1080,
|
||||
port: httpPort,
|
||||
name: MailDevResource.HttpEndpointName)
|
||||
.WithEndpoint(
|
||||
targetPort: 1025,
|
||||
port: smtpPort,
|
||||
name: MailDevResource.SmtpEndpointName);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspire.Hosting" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user