Moved BaseUrl from appsettings.json to Database and fixed an issue in UI for setting base url based on a hack, rather than asking backend for it. (#644)

This commit is contained in:
Joseph Milazzo 2021-10-06 11:03:14 -07:00 committed by GitHub
parent e8e838d125
commit 977e364d5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 52 additions and 26 deletions

View file

@ -33,6 +33,14 @@ namespace API.Controllers
_accountService = accountService;
}
[AllowAnonymous]
[HttpGet("base-url")]
public async Task<ActionResult<string>> GetBaseUrl()
{
var settingsDto = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
return Ok(settingsDto.BaseUrl);
}
[Authorize(Policy = "RequireAdminRole")]
[HttpGet]
public async Task<ActionResult<ServerSettingDto>> GetSettings()
@ -91,8 +99,6 @@ namespace API.Controllers
? $"/{updateSettingsDto.BaseUrl}"
: updateSettingsDto.BaseUrl;
setting.Value = path;
// BaseUrl is managed in appSetting.json
Configuration.BaseUrl = updateSettingsDto.BaseUrl;
_unitOfWork.SettingsRepository.Update(setting);
}