diff --git a/.gitignore b/.gitignore index 9823957..75d92e9 100644 --- a/.gitignore +++ b/.gitignore @@ -226,6 +226,6 @@ Thumbs.db .idea/ # custom -/**/**/appsettings.protected.json +/**/**/appsettings.*.json **/**/deployment.yml diff --git a/src/Nocr.TelegramClient.Host/Infrastructure/HostBuilderFactory.cs b/src/Nocr.TelegramClient.Host/Infrastructure/HostBuilderFactory.cs index dee0d8f..2d5e82d 100644 --- a/src/Nocr.TelegramClient.Host/Infrastructure/HostBuilderFactory.cs +++ b/src/Nocr.TelegramClient.Host/Infrastructure/HostBuilderFactory.cs @@ -7,14 +7,14 @@ public class HostBuilderFactory where TStartup : class public IHostBuilder CreateHostBuilder(string[] args, string? baseDirectory = null) { var builder = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(host => { host.UseStartup(); }) .ConfigureAppConfiguration((_, configurationBuilder) => { if (!string.IsNullOrWhiteSpace(baseDirectory)) configurationBuilder.SetBasePath(baseDirectory); - configurationBuilder.AddJsonFile("appsettings.protected.json", true); + configurationBuilder.AddJsonFile("appsettings.protected.json", optional: true); }) - .ConfigureWebHostDefaults(host => { host.UseStartup(); }) .UseSerilog((ctx, logBuilder) => { logBuilder.ReadFrom.Configuration(ctx.Configuration) diff --git a/src/Nocr.TelegramClient.Host/appsettings.Development.json b/src/Nocr.TelegramClient.Host/appsettings.Development.json deleted file mode 100644 index ef1d616..0000000 --- a/src/Nocr.TelegramClient.Host/appsettings.Development.json +++ /dev/null @@ -1,24 +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/" - }, - "UsersRestEaseOptions": { - "BasePath": "http://localhost:4998" - }, - "TextMatcherRestEaseOptions": { - "BasePath": "http://localhost:5001" - }, - "AdministrationOptions": { - "EnableUpdateTelegramLogging": false - } -} diff --git a/src/Nocr.TelegramClient.Host/appsettings.DockerCompose.json b/src/Nocr.TelegramClient.Host/appsettings.DockerCompose.json deleted file mode 100644 index f6278a6..0000000 --- a/src/Nocr.TelegramClient.Host/appsettings.DockerCompose.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "Serilog": { - "MinimumLevel": { - "Default": "Debug", - "Override": { - "Microsoft": "Information", - "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}" - } - }, - { - "Name": "File", - "Args": { - "path": "/var/log/nocr/telegram-client/telegram-client-.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/" - }, - "UsersRestEaseOptions": { - "BasePath": "http://nocr-users:8080" - }, - "TextMatcherRestEaseOptions": { - "BasePath": "http://nocr-text-matcher:8080" - } -} \ No newline at end of file diff --git a/src/Nocr.TelegramClient.Host/appsettings.Production.json b/src/Nocr.TelegramClient.Host/appsettings.Production.json deleted file mode 100644 index 93dc056..0000000 --- a/src/Nocr.TelegramClient.Host/appsettings.Production.json +++ /dev/null @@ -1,25 +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-client/nocr-telegram-client-.log", - "outputTemplate": "[{Level:u3}] {Timestamp:dd-MM-yyyy HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}", - "fileSizeLimitBytes": 104857600, - "rollingInterval": "Day", - "rollOnFileSizeLimit": true - } - } - ] - } -} diff --git a/src/Nocr.TelegramClient.Host/appsettings.json b/src/Nocr.TelegramClient.Host/appsettings.json index e330ca7..8e78d24 100644 --- a/src/Nocr.TelegramClient.Host/appsettings.json +++ b/src/Nocr.TelegramClient.Host/appsettings.json @@ -7,13 +7,36 @@ "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.client.queue", "DirectExchangeName": "nocr.direct", "TopicsExchangeName": "nocr.topics" }, + "UsersRestEaseOptions": { + "BasePath": "" + }, + "TextMatcherRestEaseOptions": { + "BasePath": "" + }, + "TelegramBotOptions": { + "Token": "" + }, + "AdministrationOptions": { + "EnableUpdateTelegramLogging": false, + "FeedbackReceiverIds": [], + "UpdateReceiverIds": [] + }, "MessageDispatcherOptions": { "Interval": "00:00:00.050", "ExceptionInterval": "00:00:30" @@ -22,9 +45,5 @@ "Path": "Resources", "Pattern": "", "ReadNestedFolders": "true" - }, - "AdministrationOptions": { - "FeedbackReceiverIds": [], - "UpdateReceiverIds": [] } } diff --git a/src/Nocr.TelegramClient.Host/appsettings.k8s.json b/src/Nocr.TelegramClient.Host/appsettings.k8s.json deleted file mode 100644 index 404dd02..0000000 --- a/src/Nocr.TelegramClient.Host/appsettings.k8s.json +++ /dev/null @@ -1,40 +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-client/nocr-telegram-client-.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": "" - }, - "UsersRestEaseOptions": { - "BasePath": "" - }, - "TextMatcherRestEaseOptions": { - "BasePath": "" - }, - "TelegramBotOptions": { - "Token": "" - }, - "AdministrationOptions": { - "EnableUpdateTelegramLogging": true - } -} \ No newline at end of file