Compare commits

..

No commits in common. "778543cbfde1e89ba9e015323f78ba40de5e9581" and "697f139625a1b8055f8e1b47c1082a24576936d3" have entirely different histories.

57 changed files with 113 additions and 316 deletions

View File

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 Tudor Stanciu
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -1,34 +1,25 @@
# Correo
**Correo** is a .NET service designed for programmatically sending emails. It supports communication through two simultaneous channels:
Correo is a .NET service for programmatically sending emails. Communication with this service is available through two channels simultaneously:
* HTTP (via REST API)
* Pub/Sub Messaging (via NATS)
- **HTTP (via REST API)**
- **Pub/Sub Messaging (via NATS)**
It can be integrated with several types of mediators, the configuration being the following:
Correo can be integrated with various email mediators, offering flexible configuration options.
```"SmtpMediator": "SmtpClient", //SmtpClient, SendGrid, Mailgun```
## Mediator Configuration
## Mediators
Correo supports multiple email mediators, configured using the following setting:
### SMTP servers:
* Local servers
* Gmail
* Yahoo
The integration with SMTP servers can be done through two libraries (.NET / MailKit), and the configuration area looks like this:
```json
"SmtpMediator": "SmtpClient" // Options: SmtpClient, SendGrid, Mailgun
```
## Supported Mediators
### SMTP Servers
Correo supports integration with standard SMTP email servers, including:
- **Local SMTP servers**
- **Gmail**
- **Yahoo**
SMTP integration is possible using either of two libraries: **.NET's built-in SMTP client** or **MailKit**. The configuration section in `appsettings.json` is as follows:
```json
"SmtpClient": {
"Package": "MailKit", // Options: .NET, MailKit
"Package": "MailKit", //.NET, MailKit
"Server": "smtp.gmail.com",
"Port": "587",
"UseAuthentication": true,
@ -42,29 +33,24 @@ SMTP integration is possible using either of two libraries: **.NET's built-in SM
}
```
### Transactional Email APIs
### Transactional Email APIs:
#### SendGrid
Correo also supports transactional email APIs for scalable email sending solutions:
SendGrid is a cloud-based SMTP provider that allows you to send emails without having to maintain email servers. It has an excellent and easy-to-use email API with a free plan that allows you to send 100 emails per day.
For this integration, the setup is very simple. All you need is an API Key generated from the [SendGrid](https://app.sendgrid.com/) platform. Afterwards, this API Key will be configured in Correo as below:
#### **SendGrid**
[SendGrid](https://app.sendgrid.com/) is a cloud-based SMTP provider that simplifies email sending without managing servers. It provides an easy-to-use API and a free plan allowing up to 100 emails per day.
To configure SendGrid, generate an API key from the SendGrid platform and update `appsettings.json`:
```json
"SmtpMediator": "SendGrid",
```
"SmtpMediator": "SendGrid"
"SendGrid": {
"ApiKey": "xxxxxxxxxxx"
}
```
#### **Mailgun**
[Mailgun](https://app.mailgun.com/) is an email automation service that offers transactional email APIs, with free and pay-as-you-go pricing options.
To configure Mailgun, generate an API key from Mailgun and specify the domain name in `appsettings.json`:
```json
"SmtpMediator": "Mailgun",
#### Mailgun
Mailgun is an email automation service that allows you to send, receive, and track emails. It offers a free usage plan as well as a pay-as-you-go pricing model that is based on the number of emails sent per month.
For this integration, the setup is very simple. All you need is an API Key generated from the [Mailgun](https://app.mailgun.com/) platform and the domain name configured in Mailgun. Afterwards, this keys will be configured in Correo as below:
```
"SmtpMediator": "Mailgun"
"Mailgun": {
"ApiKey": "xxxxxxxxxxx",
"Domain": "xxxxxxxxxxx"
@ -72,16 +58,10 @@ To configure Mailgun, generate an API key from Mailgun and specify the domain na
```
## Logging
The logging functionality is managed with Serilog, and its configuration is done in the ```appsettings.json``` file. In addition to its standard configuration, Correo also has a preconfigured area where three destinations for logs are available: file, Postgres database and Seq. Each of the destinations can be activated or not. If logging in the console is sufficient, all additional logging destinations can be disabled.
This configuration area is:
Correo uses **Serilog** for logging, which can be configured in `appsettings.json`. It supports logging to multiple destinations:
- **File-based logging**
- **PostgreSQL database logging**
- **Seq (structured log management)**
The logging configuration section:
```json
```
"Logs": {
"File": {
"Enabled": false,
@ -100,9 +80,4 @@ The logging configuration section:
```
## Hosting
Correo is primarily tested in **Docker** environments, but as it is built on **.NET 8**, it is cross-platform and can likely be hosted in various environments, including **Linux, Windows, and Kubernetes clusters**.
---
For further details and updates, visit the project repository or documentation.
The only hosting environment tested for this service is Docker, but considering that .NET 6 is cross platform, it can most likely be hosted in any environment.

View File

@ -1,16 +1,16 @@
<Project>
<PropertyGroup Label="Package Versions">
<MicrosoftExtensionsPackageVersion>8.0.0</MicrosoftExtensionsPackageVersion>
<SerilogPackageVersion>8.0.3</SerilogPackageVersion>
<MicrosoftExtensionsPackageVersion>6.0.0</MicrosoftExtensionsPackageVersion>
<SerilogPackageVersion>6.1.0</SerilogPackageVersion>
<SerilogSinksPostgreSQLPackageVersion>2.3.0</SerilogSinksPostgreSQLPackageVersion>
<SerilogSinksSeqPackageVersion>8.0.0</SerilogSinksSeqPackageVersion>
<SwashbucklePackageVersion>8.0.0</SwashbucklePackageVersion>
<AutoMapperPackageVersion>14.0.0</AutoMapperPackageVersion>
<MediatRPackageVersion>12.4.1</MediatRPackageVersion>
<MediatRContractsPackageVersion>2.0.1</MediatRContractsPackageVersion>
<NBBPackageVersion>8.0.4</NBBPackageVersion>
<MailKitPackageVersion>4.11.0</MailKitPackageVersion>
<SendGridPackageVersion>9.29.3</SendGridPackageVersion>
<RestSharpPackageVersion>112.1.0</RestSharpPackageVersion>
<SerilogSinksSeqPackageVersion>5.2.2</SerilogSinksSeqPackageVersion>
<SwashbucklePackageVersion>6.2.3</SwashbucklePackageVersion>
<AutoMapperPackageVersion>12.0.1</AutoMapperPackageVersion>
<AutoMapperExtensionsPackageVersion>12.0.0</AutoMapperExtensionsPackageVersion>
<MediatRPackageVersion>9.0.0</MediatRPackageVersion>
<NBBPackageVersion>6.0.30</NBBPackageVersion>
<MailKitPackageVersion>3.4.3</MailKitPackageVersion>
<SendGridPackageVersion>9.28.1</SendGridPackageVersion>
<RestSharpPackageVersion>108.0.3</RestSharpPackageVersion>
</PropertyGroup>
</Project>

View File

@ -3,6 +3,6 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="sta.nuget.public" value="https://lab.code-rove.com/public-nuget-server/v3/index.json" />
<add key="sta.nuget.public" value="https://lab.code-rove.com/public-nuget-server/nuget" />
</packageSources>
</configuration>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using System.Collections.Generic;
using System.Collections.Generic;
namespace Correo.Abstractions
{

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
namespace Correo.Abstractions.Extensions

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using System.Threading;
using System.Threading;
using System.Threading.Tasks;
namespace Correo.Abstractions

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using AutoMapper;
using AutoMapper;
using Correo.Abstractions;
using Correo.Application.Extensions;
using Correo.Domain.Models;
@ -33,7 +31,7 @@ namespace Correo.Application.CommandHandlers
_mailer=mailer;
}
public async Task Handle(SendEmail command, CancellationToken cancellationToken)
public async Task<Unit> Handle(SendEmail command, CancellationToken cancellationToken)
{
try
{
@ -49,6 +47,8 @@ namespace Correo.Application.CommandHandlers
await _messageBusPublisher.PublishAsync(new EmailSentFailed(command.Subject, ex.Message), cancellationToken);
throw;
}
return Unit.Value;
}
}
}

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Application.Extensions;
using Correo.Domain.Models;
using MediatR;

View File

@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="$(AutoMapperPackageVersion)" />
<PackageReference Include="MediatR" Version="$(MediatRPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageReference Include="NBB.Messaging.Abstractions" Version="$(NBBPackageVersion)" />
</ItemGroup>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Domain.Models;
using Correo.Domain.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Domain.Models;
namespace Correo.Application.Extensions

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Application.Utils;
using System;
using System.Linq;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using AutoMapper;
using AutoMapper;
using Correo.Abstractions;
using Correo.Application.CommandHandlers;
using Correo.PublishedLanguage.Commands;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using MediatR;
using MediatR;
using System;
using System.IO;
using System.Reflection;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
namespace Correo.Application.Utils
{

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
namespace Correo.Domain.Models
namespace Correo.Domain.Models
{
public record DefaultSender
{

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.MailKit.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using MimeKit;
using System.Collections.Generic;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Abstractions.Extensions;
using Correo.MailKit.Extensions;
using Correo.MailKit.Models;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
namespace Correo.MailKit.Models
namespace Correo.MailKit.Models
{
public record SmtpClientOptions
{

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Mailgun.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Abstractions.Extensions;
using Correo.Mailgun.Extensions;
using Correo.Mailgun.Models;
@ -24,7 +22,10 @@ namespace Correo.Mailgun
{
_optionsAccessor = optionsAccessor;
_logger = logger;
_client = new RestClient("https://api.mailgun.net/v3");
_client = new RestClient("https://api.mailgun.net/v3")
{
Authenticator = new HttpBasicAuthenticator("api", _optionsAccessor.Value.ApiKey)
};
}
public void Dispose()
@ -60,7 +61,6 @@ namespace Correo.Mailgun
request.AddParameter("bcc", bcc);
request.Method = Method.Post;
request.Authenticator = new HttpBasicAuthenticator("api", _optionsAccessor.Value.ApiKey);
var response = await _client.ExecuteAsync<MailgunResponse>(request, token);
if (response.IsSuccessful)
{

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
namespace Correo.Mailgun.Models
namespace Correo.Mailgun.Models
{
internal record MailgunOptions
{

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
namespace Correo.Mailgun.Models
namespace Correo.Mailgun.Models
{
public record MailgunResponse
{

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.NetSmtpClient.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using System.Collections.Generic;
using System.Net.Mail;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
namespace Correo.NetSmtpClient.Models
namespace Correo.NetSmtpClient.Models
{
public record SmtpClientOptions
{

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Abstractions.Extensions;
using Correo.NetSmtpClient.Extensions;
using Correo.NetSmtpClient.Models;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using MediatR;
using MediatR;
using System.Collections.Generic;
namespace Correo.PublishedLanguage.Commands

View File

@ -1,34 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.1.0</Version>
<Description>Correo.PublishedLanguage is a NuGet package that encapsulates the published language of Correo. It streamlines communication with the server in a .NET environment by providing essential DTOs (Data Transfer Objects) and constants.</Description>
<PackageProjectUrl>https://lab.code-rove.com/gitea/tudor.stanciu/correo</PackageProjectUrl>
<RepositoryUrl>https://lab.code-rove.com/gitea/tudor.stanciu/correo</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/ReleaseNotes.txt"))</PackageReleaseNotes>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.1</Version>
<PackageIcon>correo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Company>Toodle HomeLab</Company>
<Copyright>Toodle Correo</Copyright>
<PackageTags>Correo HomeLab CodeRove</PackageTags>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Description>Correo published language</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MediatR.Contracts" Version="$(MediatRContractsPackageVersion)" />
<PackageReference Include="MediatR" Version="$(MediatRPackageVersion)" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\LICENSE.txt" Link="LICENSE.txt">
<Pack>true</Pack>
<PackagePath>/</PackagePath>
</Content>
<None Update="README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="correo.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using MediatR;
using MediatR;
namespace Correo.PublishedLanguage.Events
{

View File

@ -1,73 +0,0 @@
# Correo.PublishedLanguage
[Correo](https://lab.code-rove.com/gitea/tudor.stanciu/correo) is a .NET service for programmatically sending emails. Communication with this service is available through two channels:
- **HTTP** (via REST API)
- **Pub/Sub Messaging** (via NATS)
**Correo.PublishedLanguage** is a NuGet package that encapsulates the published language of **Correo**. It streamlines communication with the server in a .NET environment by providing essential **DTOs (Data Transfer Objects)** and constants. This package equips developers with the necessary tools to integrate the API's functionality into their applications using clear and consistent data structures.
## Key Features
- Provides pre-defined DTOs for seamless communication with Correo.
- Includes constants for maintaining consistency across applications.
- Supports both HTTP and Pub/Sub messaging channels.
- Simplifies integration with Correo's email service.
By leveraging **Correo.PublishedLanguage**, developers can effortlessly incorporate email-sending functionalities into their applications, improving user notifications and communication workflows.
## Package Repository
You can install **Correo.PublishedLanguage** from my self-hosted NuGet feed: [https://lab.code-rove.com/public-nuget-server/](https://lab.code-rove.com/public-nuget-server/)
## Installation
### Visual Studio
#### NuGet.config File
To integrate the package, configure your Visual Studio solution with the following `NuGet.config` file:
```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="lab.nuget" value="https://lab.code-rove.com/public-nuget-server/v3/index.json" />
</packageSources>
</configuration>
```
Add this `NuGet.config` file to your solution directory, or alternatively, configure the new NuGet feed in the NuGet Package Manager within Visual Studio. After completing this setup, you can install `Correo.PublishedLanguage` using the NuGet Package Manager.
### CLI
To install the package via the command line, run the following command in a terminal within your .NET project directory:
```bash
dotnet add package Correo.PublishedLanguage --source https://lab.code-rove.com/public-nuget-server/v3/index.json
```
## Usage
Once installed, you can use the DTOs and constants provided by the package to communicate effectively with Correos API. Here's an example of how to use a DTO in your application:
```csharp
using NetworkResurrector.Server.PublishedLanguage;
// Example usage of a DTO from the package
var cmd = new SendEmail()
{
Subject = "Hello from Correo",
Body = "Hello from Correo",
IsBodyHtml = false,
To = [ "user@homelab.com" ]
};
await _messageBusPublisher.PublishAsync(cmd);
// Your logic here
```
This package simplifies email integration within your .NET applications, ensuring efficient and reliable messaging capabilities.

View File

@ -1,9 +0,0 @@
1.1.0 release [2025-03-29 14:34]
◾ Added support for .NET 8.0
◾ Added release notes and readme files
1.0.1 release [2023-01-29 00:33]
◾ Small fix for Mailgun email address
1.0.0 release [2023-01-18 2:12]
◾ Initial release of Correo.PublishedLanguage

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.SendGrid.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using SendGrid.Helpers.Mail;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
namespace Correo.SendGrid.Models
namespace Correo.SendGrid.Models
{
internal record Error
{

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
namespace Correo.SendGrid.Models
namespace Correo.SendGrid.Models
{
internal record SendGridOptions
{

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Abstractions;
using Correo.Abstractions;
using Correo.Abstractions.Extensions;
using Correo.SendGrid.Extensions;
using Correo.SendGrid.Models;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using AutoMapper;
using AutoMapper;
using Correo.Application.CommandHandlers;
using Correo.PublishedLanguage.Commands;
using MediatR;

View File

@ -1,5 +1,3 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Application.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;

View File

@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapperExtensionsPackageVersion)" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="$(MediatRPackageVersion)" />
<PackageReference Include="NBB.Messaging.Host" Version="$(NBBPackageVersion)" />
<PackageReference Include="NBB.Messaging.Nats" Version="$(NBBPackageVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />

View File

@ -1,11 +1,10 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base
WORKDIR /app
EXPOSE 80
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
WORKDIR /workspace
COPY ["dependencies.props", "."]
COPY ["Directory.Build.props", "."]
@ -22,11 +21,10 @@ COPY ["src/Correo.SendGrid/Correo.SendGrid.csproj", "src/Correo.SendGrid/"]
RUN dotnet restore "src/Correo/Correo.csproj"
COPY . .
WORKDIR "/workspace/src/Correo"
RUN dotnet build "Correo.csproj" -c $BUILD_CONFIGURATION -o /app/build
RUN dotnet build "Correo.csproj" -c Release -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Correo.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
RUN dotnet publish "Correo.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using System;
using System;
namespace Correo.Extensions
{

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using NpgsqlTypes;
using Serilog;
using Serilog.Sinks.PostgreSQL;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Middlewares;
using Correo.Middlewares;
using MediatR;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Mailgun;
using Correo.Mailgun;
using Correo.MailKit;
using Correo.NetSmtpClient;
using Correo.SendGrid;

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Application;
using Correo.Application;
using MediatR;
using MediatR.Pipeline;
using Microsoft.AspNetCore.Builder;
@ -25,7 +23,7 @@ namespace Correo.Extensions
services.AddAutoMapper(typeof(Application.Mappings.MappingProfile).Assembly);
// MediatR
services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<Application.Queries.GetSystemVersion>());
services.AddMediatR(typeof(Application.Queries.GetSystemVersion).Assembly);
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(RequestPreProcessorBehavior<,>));
// Messaging

View File

@ -1,6 +1,4 @@
// Copyright (c) 2023 Tudor Stanciu
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using System.Threading;
using System;

View File

@ -1,5 +1,3 @@
// Copyright (c) 2023 Tudor Stanciu
using Correo.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;