diff --git a/API/API.csproj b/API/API.csproj
index 01c1fde..bc00093 100644
--- a/API/API.csproj
+++ b/API/API.csproj
@@ -15,24 +15,25 @@
-
+
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
-
-
-
+
+
+
+
@@ -43,4 +44,11 @@
+
+ true
+
+
+
+
+
diff --git a/API/Constants.cs b/API/Constants.cs
index 253bf59..28b9513 100644
--- a/API/Constants.cs
+++ b/API/Constants.cs
@@ -4,14 +4,6 @@ namespace API;
public struct Constants
{
- public const string TRANGA =
- "\n\n" +
- " _______ v2\n" +
- "|_ _|.----..---.-..-----..-----..---.-.\n" +
- " | | | _|| _ || || _ || _ |\n" +
- " |___| |__| |___._||__|__||___ ||___._|\n" +
- " |_____| \n\n";
-
public static readonly Size ImageSmSize = new (225, 320);
public static readonly Size ImageMdSize = new (450, 640);
public static readonly Size ImageLgSize = new (900, 1280);
diff --git a/API/Program.cs b/API/Program.cs
index f6f2d5c..57fe235 100644
--- a/API/Program.cs
+++ b/API/Program.cs
@@ -14,11 +14,21 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Npgsql;
-XmlConfigurator.ConfigureAndWatch(new FileInfo("Log4Net.config.xml"));
-ILog Log = LogManager.GetLogger("Startup");
-Log.Info("Logger Configured.");
+string tranga =
+ "\n\n" +
+ " _______ v2\n" +
+ "|_ _|.----..---.-..-----..-----..---.-.\n" +
+ " | | | _|| _ || || _ || _ |\n" +
+ " |___| |__| |___._||__|__||___ ||___._|\n" +
+ " |_____| \n" +
+ $"{GitInformation.Branch}-{GitInformation.ShortCommit}-{BuildInformation.BuildAt} for {BuildInformation.Platform}\n\n";
-Log.Info("Starting up");
+XmlConfigurator.ConfigureAndWatch(new FileInfo("Log4Net.config.xml"));
+ILog log = LogManager.GetLogger("Startup");
+log.Info(tranga);
+log.Info("Logger Configured.");
+
+log.Info("Starting up");
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddCors(options =>
@@ -33,7 +43,7 @@ builder.Services.AddCors(options =>
});
});
-Log.Debug("Adding API-Explorer-helpers...");
+log.Debug("Adding API-Explorer-helpers...");
builder.Services.AddApiVersioning(option =>
{
option.AssumeDefaultVersionWhenUnspecified = true;
@@ -62,7 +72,7 @@ builder.Services.AddSwaggerGenNewtonsoftSupport().AddSwaggerGen(opt =>
opt.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});
-Log.Debug("Adding Database-Connection...");
+log.Debug("Adding Database-Connection...");
NpgsqlConnectionStringBuilder connectionStringBuilder = new()
{
Host = Environment.GetEnvironmentVariable("POSTGRES_HOST") ?? "tranga-pg:5432",
@@ -97,7 +107,7 @@ builder.Services.AddScoped(_ => LogManager.GetLogger("API"));
builder.WebHost.UseUrls("http://*:6531");
-Log.Info("Starting app...");
+log.Info("Starting app...");
WebApplication app = builder.Build();
app.UseCors("AllowAll");
@@ -109,12 +119,12 @@ ApiVersionSet apiVersionSet = app.NewApiVersionSet()
app.UseCors("AllowAll");
-Log.Debug("Mapping Controllers...");
+log.Debug("Mapping Controllers...");
app.MapControllers()
.WithApiVersionSet(apiVersionSet)
.MapToApiVersion(2);
-Log.Debug("Adding Swagger...");
+log.Debug("Adding Swagger...");
app.UseSwagger(opts =>
{
opts.OpenApiVersion = OpenApiSpecVersion.OpenApi3_0;
@@ -129,7 +139,7 @@ app.UseHttpsRedirection();
try //Connect to DB and apply migrations
{
- Log.Debug("Applying Migrations...");
+ log.Debug("Applying Migrations...");
using (IServiceScope scope = app.Services.CreateScope())
{
MangaContext context = scope.ServiceProvider.GetRequiredService();
@@ -172,14 +182,14 @@ try //Connect to DB and apply migrations
}
catch (Exception e)
{
- Log.Debug("Migrations failed!", e);
+ log.Debug("Migrations failed!", e);
return;
}
-Log.Info("Starting Tranga.");
+log.Info("Starting Tranga.");
Tranga.ServiceProvider = app.Services;
Tranga.StartupTasks();
Tranga.AddDefaultWorkers();
-Log.Info("Running app.");
+log.Info("Running app.");
app.Run();
\ No newline at end of file
diff --git a/API/Tranga.cs b/API/Tranga.cs
index 4f337e9..5682aa6 100644
--- a/API/Tranga.cs
+++ b/API/Tranga.cs
@@ -10,12 +10,12 @@ using API.Workers.MangaDownloadWorkers;
using API.Workers.PeriodicWorkers;
using API.Workers.PeriodicWorkers.MaintenanceWorkers;
using log4net;
-using log4net.Config;
namespace API;
public static class Tranga
{
+
internal static IServiceProvider? ServiceProvider { get; set; }
private static readonly ILog Log = LogManager.GetLogger(typeof(Tranga));
@@ -37,7 +37,6 @@ public static class Tranga
internal static void StartupTasks()
{
- Log.Info(Constants.TRANGA);
AddWorker(SendNotificationsWorker);
AddWorker(CleanupMangaconnectorIdsWithoutConnector);
AddWorker(UpdateChaptersDownloadedWorker);
diff --git a/README.md b/README.md
index dd5f184..34647fb 100644
--- a/README.md
+++ b/README.md
@@ -100,6 +100,7 @@ Endpoints are documented in Swagger. Just spin up an instance, and go to `http:/
- [Soenneker.Utils.String.NeedlemanWunsch](https://github.com/soenneker/soenneker.utils.string.needlemanwunsch/blob/main/LICENSE)
- [Jikan](https://jikan.moe/)
- [Jikan.Net](https://github.com/Ervie/jikan.net)
+- [BuildInformation](https://github.com/linkdotnet/BuildInformation)
- 💙 Blåhaj 🦈
(back to top)