Refactor database provider configuration logic
Moved SQL Database Provider initialization from a constant to configuration-based dynamic parsing. Enhanced logging configuration for specific components and removed unused tenant and Kafka configurations in appsettings.json for clarity and efficiency.
This commit is contained in:
parent
6022df165c
commit
844af43f39
|
|
@ -58,7 +58,6 @@ using StackExchange.Redis;
|
|||
|
||||
// ReSharper disable RedundantAssignment
|
||||
const PersistenceProvider persistenceProvider = PersistenceProvider.EntityFrameworkCore;
|
||||
const SqlDatabaseProvider sqlDatabaseProvider = SqlDatabaseProvider.Sqlite;
|
||||
const bool useHangfire = false;
|
||||
const bool useQuartz = true;
|
||||
const bool useMassTransit = true;
|
||||
|
|
@ -94,6 +93,7 @@ var rabbitMqConnectionString = configuration.GetConnectionString("RabbitMq")!;
|
|||
var redisConnectionString = configuration.GetConnectionString("Redis")!;
|
||||
var distributedLockProviderName = configuration.GetSection("Runtime:DistributedLocking")["Provider"];
|
||||
var appRole = Enum.Parse<ApplicationRole>(configuration["AppRole"] ?? "Default");
|
||||
var sqlDatabaseProvider = Enum.Parse<SqlDatabaseProvider>(configuration["DatabaseProvider"] ?? "Sqlite");
|
||||
|
||||
// Optionally create type aliases for easier configuration.
|
||||
TypeAliasRegistry.RegisterAlias("OrderReceivedProducerFactory", typeof(GenericProducerFactory<string, OrderReceived>));
|
||||
|
|
|
|||
|
|
@ -2,20 +2,27 @@
|
|||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
"Elsa": "Warning",
|
||||
"MassTransit": "Warning",
|
||||
"Microsoft.Extensions.Http": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information",
|
||||
"Microsoft.EntityFrameworkCore": "Warning",
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"Quartz": "Warning",
|
||||
"System.Net.Http": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"Sqlite": "Data Source=App_Data/elsa.sqlite.db;Cache=Shared;",
|
||||
"PostgreSql": "Server=localhost;Username=elsa;Database=elsa;Port=5432;Password=elsa;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60",
|
||||
"MySql": "Server=localhost;Port=3306;Database=elsa;User=admin;Password=password;",
|
||||
"CockroachDb": "Host=localhost;Port=26257;Database=elsa;SslMode=Disable;Username=root;IncludeErrorDetail=true",
|
||||
"MongoDb": "mongodb://localhost:27017/elsa-workflows",
|
||||
"AzureServiceBus": "",
|
||||
"RabbitMq": "amqp://guest:guest@localhost:5672",
|
||||
"Redis": "localhost:6379,abortConnect=false"
|
||||
},
|
||||
"DatabaseProvider": "Sqlite",
|
||||
"Multitenancy": {
|
||||
"Tenants": [
|
||||
{
|
||||
|
|
@ -30,19 +37,6 @@
|
|||
"Sqlite": "Data Source=App_Data/elsa.sqlite.db;Cache=Shared;"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Id": "tenant-1",
|
||||
"Name": "Tenant 1",
|
||||
"Configuration": {
|
||||
"Http": {
|
||||
"Prefix": "tenant-1",
|
||||
"Host": "localhost:5002"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Sqlite": "Data Source=App_Data/elsa.sqlite.db;Cache=Shared;"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -174,7 +168,6 @@
|
|||
}
|
||||
},
|
||||
"AzureServiceBus": {
|
||||
"ConnectionStringOrName": "AzureServiceBus",
|
||||
"Queues": [
|
||||
{
|
||||
"Name": "queue1"
|
||||
|
|
@ -197,41 +190,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"Kafka": {
|
||||
"Topics": [
|
||||
{
|
||||
"Id": "topic-1",
|
||||
"Name": "topic-1"
|
||||
},
|
||||
{
|
||||
"Id": "topic-2",
|
||||
"Name": "topic-2"
|
||||
}
|
||||
],
|
||||
"Producers": [
|
||||
{
|
||||
"Id": "producer-1",
|
||||
"Name": "Producer 1",
|
||||
"FactoryType": "Elsa.Kafka.Factories.GenericProducerFactory`2[[System.String, System.Private.CoreLib], [Elsa.Server.Web.Messages.OrderReceived, Elsa.Server.Web]], Elsa.Kafka",
|
||||
"Config": {
|
||||
"BootstrapServers": "localhost:9092"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Consumers": [
|
||||
{
|
||||
"Id": "consumer-1",
|
||||
"Name": "Consumer 1",
|
||||
"FactoryType": "Elsa.Kafka.Factories.GenericConsumerFactory`2[[System.String, System.Private.CoreLib], [Elsa.Server.Web.Messages.OrderReceived, Elsa.Server.Web]], Elsa.Kafka",
|
||||
"Config": {
|
||||
"BootstrapServers": "localhost:9092",
|
||||
"GroupId": "group-1",
|
||||
"AutoOffsetReset": "earliest",
|
||||
"EnableAutoCommit": "true"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Secrets": {
|
||||
"Management": {
|
||||
"SweepInterval": "04:00:00"
|
||||
|
|
|
|||
Loading…
Reference in a new issue