[backend/startup] Set content root path to assembly directory
This commit is contained in:
parent
2e42a3ba10
commit
0d7532cb08
2 changed files with 8 additions and 4 deletions
|
@ -1,8 +1,10 @@
|
|||
using System.Reflection;
|
||||
|
||||
namespace Iceshrimp.Backend.Core.Helpers;
|
||||
|
||||
public static class StartupHelpers
|
||||
{
|
||||
public static void ParseCliArguments(string[] args)
|
||||
public static WebApplicationOptions ParseCliArguments(string[] args)
|
||||
{
|
||||
if (args.Contains("-h") || args.Contains("--help") || args.Contains("-?"))
|
||||
{
|
||||
|
@ -30,5 +32,8 @@ public static class StartupHelpers
|
|||
Console.WriteLine(config);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
var contentRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
return new WebApplicationOptions { Args = args, ContentRootPath = contentRoot };
|
||||
}
|
||||
}
|
|
@ -3,9 +3,8 @@ using Iceshrimp.Backend.Core.Helpers;
|
|||
using Iceshrimp.Backend.SignalR;
|
||||
using Iceshrimp.Backend.SignalR.Authentication;
|
||||
|
||||
StartupHelpers.ParseCliArguments(args);
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var options = StartupHelpers.ParseCliArguments(args);
|
||||
var builder = WebApplication.CreateBuilder(options);
|
||||
|
||||
builder.Configuration.Sources.Clear();
|
||||
builder.Configuration.AddCustomConfiguration();
|
||||
|
|
Loading…
Add table
Reference in a new issue