diff --git a/.gitignore b/.gitignore index 8afdcb6..b1fc462 100644 --- a/.gitignore +++ b/.gitignore @@ -452,3 +452,9 @@ $RECYCLE.BIN/ !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json + + +# SqlLite +*.db-shm +*.db-wal +*.db diff --git a/BlueWest.Api/Extensions/StartupExtensions.cs b/BlueWest.Api/Extensions/StartupExtensions.cs index 3f71a82..58f9540 100644 --- a/BlueWest.Api/Extensions/StartupExtensions.cs +++ b/BlueWest.Api/Extensions/StartupExtensions.cs @@ -28,14 +28,17 @@ namespace BlueWest.WebApi IConfiguration configuration, IWebHostEnvironment environment) { + var sqlVersion = GetMySqlServerVersion(8, 0, 11); optionsBuilder - .UseMySql(configuration.GetConnectionString("DockerMySQL"), GetMySqlServerVersion(8, 0, 11)) - .UseMySql(GetMySqlServerVersion(8, 0, 11), - builder => - { - builder.EnableRetryOnFailure(6, TimeSpan.FromSeconds(3), null); - }); + .UseMySql( + configuration.GetConnectionString("DockerMySQL"), + sqlVersion) + .UseMySql(sqlVersion, + builder => + { + builder.EnableRetryOnFailure(6, TimeSpan.FromSeconds(3), null); + }); // The following three options help with debugging, but should // be changed or removed for production. @@ -57,7 +60,7 @@ namespace BlueWest.WebApi /// /// /// - public static IServiceCollection PrepareMySQLDatabasePool(this IServiceCollection serviceCollection, + public static IServiceCollection PrepareMySqlDatabasePool(this IServiceCollection serviceCollection, IConfiguration configuration, IWebHostEnvironment environment) { return serviceCollection @@ -74,7 +77,7 @@ namespace BlueWest.WebApi /// /// /// - public static IServiceCollection PrepareSQLLiteDatabasePool(this IServiceCollection serviceCollection, + public static IServiceCollection PrepareSqlLiteDatabasePool(this IServiceCollection serviceCollection, IConfiguration configuration, IWebHostEnvironment environment) { return serviceCollection diff --git a/BlueWest.Api/Startup.cs b/BlueWest.Api/Startup.cs index 0567b55..99e5c4d 100644 --- a/BlueWest.Api/Startup.cs +++ b/BlueWest.Api/Startup.cs @@ -60,20 +60,7 @@ namespace BlueWest.WebApi options.SwaggerDoc("v1", new OpenApiInfo { Title = "BlueWest.Api.App", - Version = "v1", - Description = "BlueWest.Api.App", - TermsOfService = new Uri("https://git.codeliturgy.com/terms-of-service"), - Contact = new OpenApiContact - { - Name = "Benny", - Email = string.Empty, - Url = new Uri("https://git.codeliturgy.com"), - }, - License = new OpenApiLicense - { - Name = "Use under LICX", - Url = new Uri("https://git.codeliturgy.com/license"), - } + Version = "v1" }); // Set the comments path for the Swagger JSON and UI. @@ -92,17 +79,20 @@ namespace BlueWest.WebApi services .AddSingleton(); - if (allowedDatabase == "mysql") + switch (allowedDatabase) { - services - .PrepareMySQLDatabasePool(_configuration, _environment); + case "mysql": + services.PrepareMySqlDatabasePool(_configuration, _environment); + break; + + case "sqlite": + services.PrepareSqlLiteDatabasePool(_configuration, _environment); + break; + + default: + throw new InvalidOperationException("config.json doesn't specify a valid database. Use mysql or sqlite."); } - if (allowedDatabase == "sqlite") - { - services.PrepareSQLLiteDatabasePool(_configuration, _environment); - } - services.AddScoped(); @@ -110,6 +100,7 @@ namespace BlueWest.WebApi } + /// /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. /// diff --git a/BlueWest.Frontend b/BlueWest.Frontend index 5006902..ba851c4 160000 --- a/BlueWest.Frontend +++ b/BlueWest.Frontend @@ -1 +1 @@ -Subproject commit 5006902892221cef14127637b20f6f59ae28a311 +Subproject commit ba851c4f946fd370f888a8aa902ac5f46a982e73