Base Url Support (#642)

* Added base url config

* UI side is not working

* Working base url more

* Attempt to get UI to work with base url

* Implemented the ability to set the Base URL for the app

* Hooked in Base URL as a managed setting

* Ensure we always start with / for base url

* Removed default base href from debug builds. Cleaned up an issue with base url migration.

* Fixed an issue with our BaseURL migration
This commit is contained in:
Joseph Milazzo 2021-10-06 05:42:02 -07:00 committed by GitHub
parent 56239ee0a7
commit 27aaa040c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 126 additions and 10 deletions

View file

@ -50,6 +50,7 @@ namespace API.Data
new () {Key = ServerSettingKey.AllowStatCollection, Value = "true"},
new () {Key = ServerSettingKey.EnableOpds, Value = "false"},
new () {Key = ServerSettingKey.EnableAuthentication, Value = "true"},
new () {Key = ServerSettingKey.BaseUrl, Value = ""},// Not used from DB, but DB is sync with appSettings.json
};
foreach (var defaultSetting in defaultSettings)
@ -63,11 +64,20 @@ namespace API.Data
await context.SaveChangesAsync();
if (string.IsNullOrEmpty(Configuration.BaseUrl))
{
Configuration.BaseUrl = "/";
}
// Port and LoggingLevel are managed in appSettings.json. Update the DB values to match
context.ServerSetting.First(s => s.Key == ServerSettingKey.Port).Value =
Configuration.Port + string.Empty;
context.ServerSetting.First(s => s.Key == ServerSettingKey.LoggingLevel).Value =
Configuration.LogLevel + string.Empty;
context.ServerSetting.First(s => s.Key == ServerSettingKey.BaseUrl).Value =
Configuration.BaseUrl;
await context.SaveChangesAsync();