Add Application configuration #11

Merged
Wesser merged 128 commits from feat/add-setup into release/v1.0.0 2024-06-01 07:35:30 +03:00
Showing only changes of commit 62ccf94222 - Show all commits

View File

@ -1,4 +1,6 @@
using Mirea.Api.Endpoint.Configuration.General.Attributes; using System;
using Mirea.Api.DataAccess.Persistence.Common;
using Mirea.Api.Endpoint.Configuration.General.Attributes;
using Mirea.Api.Endpoint.Configuration.General.Interfaces; using Mirea.Api.Endpoint.Configuration.General.Interfaces;
namespace Mirea.Api.Endpoint.Configuration.General.Settings; namespace Mirea.Api.Endpoint.Configuration.General.Settings;
@ -15,8 +17,15 @@ public class DbSettings : IIsConfigured
public DatabaseEnum TypeDatabase { get; set; } public DatabaseEnum TypeDatabase { get; set; }
public required string ConnectionStringSql { get; set; } public required string ConnectionStringSql { get; set; }
public bool IsConfigured() public DatabaseProvider DatabaseProvider =>
TypeDatabase switch
{ {
return !string.IsNullOrEmpty(ConnectionStringSql); DatabaseEnum.PostgresSql => DatabaseProvider.Postgresql,
} DatabaseEnum.Mysql => DatabaseProvider.Mysql,
DatabaseEnum.Sqlite => DatabaseProvider.Sqlite,
_ => throw new ArgumentOutOfRangeException()
};
public bool IsConfigured() =>
!string.IsNullOrEmpty(ConnectionStringSql);
} }