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

@ -5,6 +5,8 @@ using System.Linq;
using System.Net;
using System.Net.Sockets;
using API.Extensions;
using API.Interfaces;
using API.Interfaces.Repositories;
using API.Middleware;
using API.Services;
using API.Services.HostedServices;
@ -121,7 +123,7 @@ namespace API
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IBackgroundJobClient backgroundJobs, IWebHostEnvironment env,
IHostApplicationLifetime applicationLifetime)
IHostApplicationLifetime applicationLifetime, IServiceProvider serviceProvider)
{
app.UseMiddleware<ExceptionMiddleware>();
@ -160,7 +162,9 @@ namespace API
app.UseDefaultFiles();
if (!string.IsNullOrEmpty(Configuration.BaseUrl))
var service = serviceProvider.GetRequiredService<IUnitOfWork>();
var settings = service.SettingsRepository.GetSettingsDto();
if (!string.IsNullOrEmpty(settings.BaseUrl) && !settings.BaseUrl.Equals("/"))
{
var path = !Configuration.BaseUrl.StartsWith("/")
? $"/{Configuration.BaseUrl}"