Release Testing Final Stretch (#1952)

* Fixed a bug breaking ability to save server settings

* Fixed a case where if a user updated appsetting.json, the DB wouldn't update to stay in alignment.
This commit is contained in:
Joe Milazzo 2023-05-02 19:59:30 -05:00 committed by GitHub
parent 2d842f3783
commit b7c9762956
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View file

@ -32,6 +32,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@ -294,8 +295,17 @@ public class Startup
{
// We don't update the index.html in local as we don't serve from there
UpdateBaseUrlInIndex(basePath);
}
// Update DB with what's in config
var dataContext = serviceProvider.GetRequiredService<DataContext>();
var setting = dataContext.ServerSetting.SingleOrDefault(x => x.Key == ServerSettingKey.BaseUrl);
if (setting != null)
{
setting.Value = basePath;
}
dataContext.SaveChanges();
}
app.UseRouting();

View file

@ -2,5 +2,5 @@
"TokenKey": "super secret unguessable key",
"Port": 5000,
"IpAddresses": "",
"BaseUrl": "/"
"BaseUrl": "/joe/"
}