diff --git a/.github/workflows/build-and-deploy.yaml b/.github/workflows/build-and-deploy.yaml
index e8eeaeb..4ae3764 100644
--- a/.github/workflows/build-and-deploy.yaml
+++ b/.github/workflows/build-and-deploy.yaml
@@ -167,6 +167,8 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
+ build-args: |
+ API_VERSION=${{ steps.sanitize-version.outputs.version }}
file: ./src/Bmb.Payment.Api/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
diff --git a/src/Bmb.Payment.Api/Bmb.Payment.Api.csproj b/src/Bmb.Payment.Api/Bmb.Payment.Api.csproj
index 28da934..eedac39 100644
--- a/src/Bmb.Payment.Api/Bmb.Payment.Api.csproj
+++ b/src/Bmb.Payment.Api/Bmb.Payment.Api.csproj
@@ -5,6 +5,8 @@
enable
enable
Windows
+ 1.0.0
+ Payment API
@@ -18,7 +20,7 @@
-
+
@@ -29,7 +31,8 @@
-
+
+
diff --git a/src/Bmb.Payment.Api/Controllers/PaymentsController.cs b/src/Bmb.Payment.Api/Controllers/PaymentsController.cs
index fa487d8..9a442b6 100644
--- a/src/Bmb.Payment.Api/Controllers/PaymentsController.cs
+++ b/src/Bmb.Payment.Api/Controllers/PaymentsController.cs
@@ -1,7 +1,7 @@
-using Bmb.Auth;
using Bmb.Payment.Api.Model;
using Bmb.Payment.Controllers.Contracts;
using Bmb.Payment.Controllers.Dto;
+using Bmb.Tools.Auth;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/src/Bmb.Payment.Api/Dockerfile b/src/Bmb.Payment.Api/Dockerfile
index 7be01f4..ccd8ad8 100644
--- a/src/Bmb.Payment.Api/Dockerfile
+++ b/src/Bmb.Payment.Api/Dockerfile
@@ -15,7 +15,8 @@ RUN dotnet restore src/Bmb.Payment.Api
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
-RUN dotnet publish "src/Bmb.Payment.Api/Bmb.Payment.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
+ARG API_VERSION
+RUN dotnet publish "src/Bmb.Payment.Api/Bmb.Payment.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:Version=$API_VERSION
FROM base AS final
diff --git a/src/Bmb.Payment.Api/Program.cs b/src/Bmb.Payment.Api/Program.cs
index d055212..6dee3c6 100644
--- a/src/Bmb.Payment.Api/Program.cs
+++ b/src/Bmb.Payment.Api/Program.cs
@@ -1,13 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Text.Json.Serialization;
-using Bmb.Auth;
using Bmb.Payment.Masstransit;
using Bmb.Payment.DI;
+using Bmb.Tools.Auth;
+using Bmb.Tools.OpenApi;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
-using Microsoft.OpenApi.Any;
-using Microsoft.OpenApi.Models;
using Serilog;
using Serilog.Events;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
@@ -23,6 +22,7 @@ public static void Main(string[] args)
ILogger? logger = null;
try
{
+ var version = Assembly.GetExecutingAssembly().GetName().Version;
builder.Host.UseSerilog((context, configuration) =>
configuration
.MinimumLevel.Debug()
@@ -35,7 +35,6 @@ public static void Main(string[] args)
builder.Services.ConfigureJwt(builder.Configuration);
builder.Services.AddAuthorization();
builder.Services.AddLogging(loggingBuilder => loggingBuilder.AddSerilog(dispose: true));
-
// Add CORS services to the DI container.
builder.Services.AddCors(options =>
{
@@ -52,36 +51,7 @@ public static void Main(string[] args)
builder.Services.AddPaymentBus();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddRouting(options => options.LowercaseUrls = true);
- builder.Services.AddSwaggerGen();
- builder.Services.AddSwaggerGen(c =>
- {
- c.SwaggerDoc("v1", new OpenApiInfo
- {
- Title = "BMB Payment API", Version = "v1", Extensions =
- {
- {
- "x-logo",
- new OpenApiObject
- {
- {
- "url",
- new OpenApiString(
- "https://avatars.githubusercontent.com/u/165858718?s=384")
- },
- {
- "background",
- new OpenApiString(
- "#FF0000")
- }
- }
- }
- }
- });
-
- var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
- var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
- c.IncludeXmlComments(xmlPath);
- });
+ builder.Services.ConfigBmbSwaggerGen();
var jwtOptions = builder.Configuration
.GetSection("JwtOptions")
@@ -108,7 +78,7 @@ public static void Main(string[] args)
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
- app.UseSwaggerUI();
+ app.UseBmbSwaggerUi();
}
app.UseSerilogRequestLogging();