From ebbec35e62ff45d3f3f7c7420ffafe36bccedde2 Mon Sep 17 00:00:00 2001 From: Ruberoid Date: Fri, 18 Jul 2025 17:11:55 +0300 Subject: [PATCH] Fixed config usages. --- .gitignore | 2 +- .../Infrastructure/HostBuilderFactory.cs | 2 +- .../appsettings.Development.json | 18 ----------- .../appsettings.DockerCompose.json | 31 ------------------- .../appsettings.Production.json | 28 ----------------- src/Nocr.TextMatcher.Host/appsettings.json | 16 ++++++++-- .../appsettings.k8s.json | 31 ------------------- .../DesignTimeTextMatcherContextFactory.cs | 1 + .../appsettings.json | 4 +-- 9 files changed, 19 insertions(+), 114 deletions(-) delete mode 100644 src/Nocr.TextMatcher.Host/appsettings.Development.json delete mode 100644 src/Nocr.TextMatcher.Host/appsettings.DockerCompose.json delete mode 100644 src/Nocr.TextMatcher.Host/appsettings.Production.json delete mode 100644 src/Nocr.TextMatcher.Host/appsettings.k8s.json 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.TextMatcher.Host/Infrastructure/HostBuilderFactory.cs b/src/Nocr.TextMatcher.Host/Infrastructure/HostBuilderFactory.cs index fa80ff8..9339ad8 100644 --- a/src/Nocr.TextMatcher.Host/Infrastructure/HostBuilderFactory.cs +++ b/src/Nocr.TextMatcher.Host/Infrastructure/HostBuilderFactory.cs @@ -12,7 +12,7 @@ public class HostBuilderFactory where TStartup : class 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) => diff --git a/src/Nocr.TextMatcher.Host/appsettings.Development.json b/src/Nocr.TextMatcher.Host/appsettings.Development.json deleted file mode 100644 index 5615168..0000000 --- a/src/Nocr.TextMatcher.Host/appsettings.Development.json +++ /dev/null @@ -1,18 +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/" - }, - "ConnectionStrings": { - "TextMatcherContext": "server=localhost;port=3306;database=nocr_text_matcher;uid=root;pwd=toor" - } -} diff --git a/src/Nocr.TextMatcher.Host/appsettings.DockerCompose.json b/src/Nocr.TextMatcher.Host/appsettings.DockerCompose.json deleted file mode 100644 index 4eb8140..0000000 --- a/src/Nocr.TextMatcher.Host/appsettings.DockerCompose.json +++ /dev/null @@ -1,31 +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/text-matcher/nocr-text-matcher-.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/" - }, - "ConnectionStrings": { - "TextMatcherContext": "server=nocr-text-matcher-db;port=3306;database=nocr_text_matcher;uid=root;pwd=toor" - } -} diff --git a/src/Nocr.TextMatcher.Host/appsettings.Production.json b/src/Nocr.TextMatcher.Host/appsettings.Production.json deleted file mode 100644 index d3c47a6..0000000 --- a/src/Nocr.TextMatcher.Host/appsettings.Production.json +++ /dev/null @@ -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/text-matcher/nocr-text-matcher-.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/" - } -} diff --git a/src/Nocr.TextMatcher.Host/appsettings.json b/src/Nocr.TextMatcher.Host/appsettings.json index 1b55ccf..c1c5882 100644 --- a/src/Nocr.TextMatcher.Host/appsettings.json +++ b/src/Nocr.TextMatcher.Host/appsettings.json @@ -6,11 +6,23 @@ "Microsoft": "Information", "Microsoft.AspNetCore": "Error", "System.Net.Http.HttpClient": "Warning", - "Rebus": "Warning" + "Rebus": "Debug" } - } + }, + "WriteTo": [ + { + "Name": "Console", + "Args": { + "outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} {TraceId} {SourceContext:l} {Message:lj}{NewLine}{Exception}" + } + } + ] + }, + "ConnectionStrings": { + "TextMatcherContext": "" }, "RebusRabbitMqOptions": { + "ConnectionString": "", "InputQueueName": "nocr.text.matcher.queue", "DirectExchangeName": "nocr.direct", "TopicsExchangeName": "nocr.topics", diff --git a/src/Nocr.TextMatcher.Host/appsettings.k8s.json b/src/Nocr.TextMatcher.Host/appsettings.k8s.json deleted file mode 100644 index ff7e4d6..0000000 --- a/src/Nocr.TextMatcher.Host/appsettings.k8s.json +++ /dev/null @@ -1,31 +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/text-matcher/nocr-text-matcher-.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": "" - }, - "ConnectionStrings": { - "TextMatcherContext": "" - } -} diff --git a/src/Nocr.TextMatcher.Migrator/DesignTimeTextMatcherContextFactory.cs b/src/Nocr.TextMatcher.Migrator/DesignTimeTextMatcherContextFactory.cs index fef3c26..de9abe9 100644 --- a/src/Nocr.TextMatcher.Migrator/DesignTimeTextMatcherContextFactory.cs +++ b/src/Nocr.TextMatcher.Migrator/DesignTimeTextMatcherContextFactory.cs @@ -16,6 +16,7 @@ public class DesignTimeTextMatcherContextFactory : IDesignTimeDbContextFactory