Implemented ability to have server settings. Currently cache directory is there but it is not configurable (or used in this commit)

This commit is contained in:
Joseph Milazzo 2021-01-23 09:01:10 -06:00
parent 8220709b4c
commit 18385a4f80
20 changed files with 2854 additions and 6 deletions

View file

@ -1,7 +1,10 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.Constants;
using API.Entities;
using API.Services;
using Microsoft.AspNetCore.Identity;
namespace API.Data
@ -25,5 +28,22 @@ namespace API.Data
}
}
}
public static async Task SeedSettings(DataContext context)
{
IList<ServerSetting> defaultSettings = new List<ServerSetting>()
{
new ServerSetting() {Key = "CacheDirectory", Value = CacheService.CacheDirectory}
};
await context.ServerSetting.AddRangeAsync(defaultSettings);
await context.SaveChangesAsync();
// await context.ServerSetting.AddAsync(new ServerSetting
// {
// CacheDirectory = CacheService.CacheDirectory
// });
//
// await context.SaveChangesAsync();
}
}
}