更新配置:增加配置文件可以配置是否自动生成登录Keys相关文件

This commit is contained in:
Argo-MacBookPro 2018-08-30 13:20:40 +08:00
parent 4647105fe6
commit 6191ea0fd3
3 changed files with 19 additions and 5 deletions

View File

@ -46,10 +46,10 @@ namespace Bootstrap.Admin
services.AddConfigurationManager();
services.AddCacheManager();
services.AddDBAccessFactory();
services.AddDataProtection(op => op.ApplicationDiscriminator = "BootstrapAdmin")
.SetApplicationName("__bd__")
.DisableAutomaticKeyGeneration()
.PersistKeysToFileSystem(new DirectoryInfo(ConfigurationManager.AppSettings["KeyPath"]));
var dataProtectionBuilder = services.AddDataProtection(op => op.ApplicationDiscriminator = Configuration["ApplicationDiscriminator"])
.SetApplicationName(Configuration["ApplicationName"])
.PersistKeysToFileSystem(new DirectoryInfo(Configuration["KeyPath"]));
if (Configuration["DisableAutomaticKeyGeneration"] == "True") dataProtectionBuilder.DisableAutomaticKeyGeneration();
services.AddMvc(options =>
{
options.Filters.Add<BootstrapAdminAuthorizeFilter>();

View File

@ -5,9 +5,20 @@
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
},
"LgbFile": {
"IncludeScopes": true,
"LogLevel": {
"Default": "Error"
},
"FileName": "Error\\Log.log"
}
},
"KeyPath": "C:\\keys",
"ConnectionStrings": {
"ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"
},
"KeyPath": "keys",
"DisableAutomaticKeyGeneration": false,
"AllowOrigins": "http://localhost:49823",
"LongbowCache": {
"CorsItems": [

View File

@ -15,7 +15,10 @@
"ConnectionStrings": {
"ba": "Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa"
},
"ApplicationName": "__bd__",
"ApplicationDiscriminator": "BootstrapAdmin",
"KeyPath": "D:\\App\\Web-App\\keys",
"DisableAutomaticKeyGeneration": true,
"AllowOrigins": "http://localhost,http://10.15.63.218",
"LongbowCache": {
"Enabled": true,