forked from extern/FakeRelay
Show a nicer error if the config file doesn't exist
This commit is contained in:
parent
ec328acb16
commit
509fbc964f
@ -30,6 +30,11 @@ public class Config
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
throw new Exception("Config file does not exist. Run the config command to create it.");
|
||||
}
|
||||
|
||||
var data = JSON.Deserialize<ConfigData>(File.ReadAllText(path));
|
||||
if (data.PublicKey == null || data.PrivateKey == null || data.Host == null)
|
||||
{
|
||||
|
@ -1,10 +1,6 @@
|
||||
using FakeRelay.Core;
|
||||
using FakeRelay.Web.Services;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
Config.Init(builder.Configuration.GetValue<string>("CONFIG_PATH"));
|
||||
|
Loading…
Reference in New Issue
Block a user