Fixed nice configs.

This commit is contained in:
Ruberoid 2025-07-18 16:57:33 +03:00
parent 269826b70f
commit 6c74bdbefc
8 changed files with 18 additions and 116 deletions

2
.gitignore vendored
View File

@ -230,6 +230,6 @@ Thumbs.db
.idea/
# custom
/**/**/appsettings.protected.json
/**/**/appsettings.*.json
**/**/deployment.yml

View File

@ -7,14 +7,14 @@ public class HostBuilderFactory<TStartup> where TStartup : class
public IHostBuilder CreateHostBuilder(string[] args, string? baseDirectory = null)
{
var builder = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(host => { host.UseStartup<TStartup>(); })
.ConfigureAppConfiguration((_, configurationBuilder) =>
{
if (!string.IsNullOrWhiteSpace(baseDirectory))
configurationBuilder.SetBasePath(baseDirectory);
configurationBuilder.AddJsonFile(".secrets/appsettings.protected.json", true);
configurationBuilder.AddJsonFile("appsettings.protected.json", optional: true);
})
.ConfigureWebHostDefaults(host => { host.UseStartup<TStartup>(); })
.UseSerilog((ctx, logBuilder) =>
{
logBuilder.ReadFrom.Configuration(ctx.Configuration)

View File

@ -31,14 +31,6 @@ public class Startup
builder.Transport(t =>
{
var rebusOptions = ctx.GetRequiredService<IOptions<RebusRabbitMqOptions>>().Value;
Console.WriteLine("*** DEBUG ***");
Console.WriteLine(Environment.GetEnvironmentVariable("RebusRabbitMqOptions__ConnectionString"));
Console.WriteLine(rebusOptions.ConnectionString);
Console.WriteLine("*** DEBUG ***");
t.UseRabbitMq(rebusOptions.ConnectionString, rebusOptions.InputQueueName)
.DefaultQueueOptions(queue => queue.SetDurable(true))
.ExchangeNames(rebusOptions.DirectExchangeName, rebusOptions.TopicsExchangeName);

View File

@ -1,15 +0,0 @@
{
"Serilog": {
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}"
}
}
]
},
"RebusRabbitMqOptions": {
"ConnectionString": "amqp://admin:admin@localhost:5672/"
}
}

View File

@ -1,28 +0,0 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Information"
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "/var/log/nocr/telegram-listener/telegram-listener-.log",
"outputTemplate": "[{Level:u3}] {Timestamp:dd-MM-yyyy HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}",
"fileSizeLimitBytes": 104857600,
"rollingInterval": "Day",
"rollOnFileSizeLimit": true
}
}
]
},
"RebusRabbitMqOptions": {
"ConnectionString": "amqp://admin:admin@nocr-rabbitmq:5672/"
}
}

View File

@ -1,28 +0,0 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Information"
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "/var/log/nocr/telegram-listener/telegram-listener-.log",
"outputTemplate": "[{Level:u3}] {Timestamp:dd-MM-yyyy HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}",
"fileSizeLimitBytes": 104857600,
"rollingInterval": "Day",
"rollOnFileSizeLimit": true
}
}
]
},
"RebusRabbitMqOptions": {
"ConnectionString": ""
}
}

View File

@ -7,11 +7,25 @@
"Microsoft.AspNetCore": "Error",
"System.Net.Http.HttpClient": "Warning"
}
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}"
}
}
]
},
"RebusRabbitMqOptions": {
"ConnectionString": "",
"InputQueueName": "nocr.telegram.listener.queue",
"DirectExchangeName": "nocr.direct",
"TopicsExchangeName": "nocr.topics"
},
"WTelegramClientOptions": {
"ApiId": "",
"ApiHash": "",
"PhoneNumber": ""
}
}

View File

@ -1,33 +0,0 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug"
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "/var/log/nocr/telegram-listener/telegram-listener-.log",
"outputTemplate": "[{Level:u3}] {Timestamp:dd-MM-yyyy HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}",
"fileSizeLimitBytes": 104857600,
"rollingInterval": "Day",
"rollOnFileSizeLimit": true
}
}
]
},
"RebusRabbitMqOptions": {
"ConnectionString": ""
},
"WTelegramClientOptions": {
"ApiId": "",
"ApiHash": "",
"PhoneNumber": ""
}
}