Misc Polishing (#413)
* Ensure that after we assign a role to a user, we show it immediately * Cached libraryType api as that is not going to change in a viewing session. Moved some components around to tighten bundles. * Cleaned up more TODOs * Refactored Configuration to use getter and setters so that the interface is a lot cleaner. Updated HashUtil to use JWT Secret instead of Machine name (as docker machine name is random each boot).
This commit is contained in:
parent
ef5b22b585
commit
b8165b311c
29 changed files with 408 additions and 307 deletions
|
@ -29,7 +29,7 @@ namespace API.Data
|
|||
var exists = await roleManager.RoleExistsAsync(role.Name);
|
||||
if (!exists)
|
||||
{
|
||||
await roleManager.CreateAsync(role);
|
||||
await roleManager.CreateAsync(role);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace API.Data
|
|||
public static async Task SeedSettings(DataContext context)
|
||||
{
|
||||
await context.Database.EnsureCreatedAsync();
|
||||
|
||||
|
||||
IList<ServerSetting> defaultSettings = new List<ServerSetting>()
|
||||
{
|
||||
new() {Key = ServerSettingKey.CacheDirectory, Value = CacheService.CacheDirectory},
|
||||
|
@ -46,7 +46,7 @@ namespace API.Data
|
|||
new () {Key = ServerSettingKey.TaskBackup, Value = "weekly"},
|
||||
new () {Key = ServerSettingKey.BackupDirectory, Value = Path.GetFullPath(Path.Join(Directory.GetCurrentDirectory(), "backups/"))},
|
||||
new () {Key = ServerSettingKey.Port, Value = "5000"}, // Not used from DB, but DB is sync with appSettings.json
|
||||
new () {Key = ServerSettingKey.AllowStatCollection, Value = "true"},
|
||||
new () {Key = ServerSettingKey.AllowStatCollection, Value = "true"},
|
||||
};
|
||||
|
||||
foreach (var defaultSetting in defaultSettings)
|
||||
|
@ -61,14 +61,13 @@ namespace API.Data
|
|||
await context.SaveChangesAsync();
|
||||
|
||||
// Port and LoggingLevel are managed in appSettings.json. Update the DB values to match
|
||||
var configFile = Program.GetAppSettingFilename();
|
||||
context.ServerSetting.FirstOrDefault(s => s.Key == ServerSettingKey.Port).Value =
|
||||
Configuration.GetPort(configFile) + "";
|
||||
Configuration.Port + string.Empty;
|
||||
context.ServerSetting.FirstOrDefault(s => s.Key == ServerSettingKey.LoggingLevel).Value =
|
||||
Configuration.GetLogLevel(configFile);
|
||||
|
||||
Configuration.LogLevel + string.Empty;
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue