diff --git a/src/Phoenix.Api.Client/appsettings.json b/src/Phoenix.Api.Client/appsettings.json index befd7b7..9b1d8eb 100644 --- a/src/Phoenix.Api.Client/appsettings.json +++ b/src/Phoenix.Api.Client/appsettings.json @@ -28,6 +28,7 @@ "Database": "Phoenix", "Username": "Phoenix", "Password": "Phoenix", + "EnableSsl": true, "CommandTimeout": 600 } } diff --git a/src/Phoenix.Api.Web/appsettings.json b/src/Phoenix.Api.Web/appsettings.json index 6f0f99b..362febe 100644 --- a/src/Phoenix.Api.Web/appsettings.json +++ b/src/Phoenix.Api.Web/appsettings.json @@ -31,6 +31,7 @@ "Database": "Phoenix", "Username": "Phoenix", "Password": "Phoenix", + "EnableSsl": true, "CommandTimeout": 600 } } diff --git a/src/Phoenix.Services/Configuration/Modules/RepositoryModule.cs b/src/Phoenix.Services/Configuration/Modules/RepositoryModule.cs index c3f2486..d564a49 100644 --- a/src/Phoenix.Services/Configuration/Modules/RepositoryModule.cs +++ b/src/Phoenix.Services/Configuration/Modules/RepositoryModule.cs @@ -25,7 +25,9 @@ protected override void Load(ContainerBuilder builder) Password = settings.Password, CommandTimeout = settings.CommandTimeout, Pooling = true, - SslMode = SslMode.Allow, + SslMode = settings.EnableSsl + ? SslMode.Prefer + : SslMode.Allow, }; DbContextOptions contextOptions = new DbContextOptionsBuilder() diff --git a/src/Phoenix.Services/Settings/SqlSettings.cs b/src/Phoenix.Services/Settings/SqlSettings.cs index 8c6a280..c2ca167 100644 --- a/src/Phoenix.Services/Settings/SqlSettings.cs +++ b/src/Phoenix.Services/Settings/SqlSettings.cs @@ -7,6 +7,7 @@ internal sealed class SqlSettings public string Database { get; init; } public string Username { get; init; } public string Password { get; init; } + public bool EnableSsl { get; init; } public ushort CommandTimeout { get; init; } public SqlSettings()