diff --git a/src/FakeRelay.Core/Config.cs b/src/FakeRelay.Core/Config.cs index 9400183..45de02a 100644 --- a/src/FakeRelay.Core/Config.cs +++ b/src/FakeRelay.Core/Config.cs @@ -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(File.ReadAllText(path)); if (data.PublicKey == null || data.PrivateKey == null || data.Host == null) { diff --git a/src/FakeRelay.Web/Program.cs b/src/FakeRelay.Web/Program.cs index 41b14ab..332f894 100644 --- a/src/FakeRelay.Web/Program.cs +++ b/src/FakeRelay.Web/Program.cs @@ -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("CONFIG_PATH"));