using System; using Newtonsoft.Json; namespace Deployment; public static class ConfigurationBootstrapper { private const string confpath = "appsettings.json"; public static T Load() where T : new() { if(File.Exists("appsettings.json")) { return JsonConvert.DeserializeObject(File.ReadAllText(confpath)) ?? new T(); } else { var toReturn = new T(); File.WriteAllText(confpath, JsonConvert.SerializeObject(toReturn)); return toReturn; } } }