apikey.creationdate
This commit is contained in:
21
.vscode/launch.json
vendored
21
.vscode/launch.json
vendored
@ -24,6 +24,27 @@
|
|||||||
"sourceFileMap": {
|
"sourceFileMap": {
|
||||||
"/Views": "${workspaceFolder}/Views"
|
"/Views": "${workspaceFolder}/Views"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ".NET Core Launch (prod)",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/nuget-host.dll",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"requireExactSource": false,
|
||||||
|
"serverReadyAction": {
|
||||||
|
"action": "openExternally",
|
||||||
|
"pattern": "\\\\bNow listening on:\\\\s+(https?://\\\\S+)"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Production"
|
||||||
|
},
|
||||||
|
"sourceFileMap": {
|
||||||
|
"/Views": "${workspaceFolder}/Views"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
@ -66,7 +67,8 @@ namespace nuget_host.Controllers
|
|||||||
ModelState.AddModelError(null, "Maximum key count reached");
|
ModelState.AddModelError(null, "Maximum key count reached");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
ApiKey newKey = new ApiKey { UserId = userid, Name = model.Name };
|
ApiKey newKey = new ApiKey { UserId = userid, Name = model.Name,
|
||||||
|
CreationDate = DateTime.Now };
|
||||||
_ = dbContext.ApiKeys.Add(newKey);
|
_ = dbContext.ApiKeys.Add(newKey);
|
||||||
_ = await dbContext.SaveChangesAsync();
|
_ = await dbContext.SaveChangesAsync();
|
||||||
return View("Details", new DetailModel { Name = newKey.Name,
|
return View("Details", new DetailModel { Name = newKey.Name,
|
||||||
|
10
Startup.cs
10
Startup.cs
@ -60,7 +60,8 @@ namespace nuget_host
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env)
|
public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
|
||||||
|
ApplicationDbContext dbContext)
|
||||||
{
|
{
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
@ -73,12 +74,7 @@ namespace nuget_host
|
|||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
|
dbContext.Database.Migrate();
|
||||||
.CreateScope())
|
|
||||||
{
|
|
||||||
serviceScope.ServiceProvider.GetService<ApplicationDbContext>()
|
|
||||||
.Database.Migrate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (TargetInvocationException ex)
|
catch (TargetInvocationException ex)
|
||||||
{
|
{
|
||||||
|
18
appsettings.Production.json
Normal file
18
appsettings.Production.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"Nuget": {
|
||||||
|
"ExternalUrl" : "<http://localhost:5000/packages",
|
||||||
|
"PackagesRootDir" : "packages",
|
||||||
|
"MaxUserKeyCount": 5
|
||||||
|
},
|
||||||
|
"Smtp": {
|
||||||
|
"Server": "localhost",
|
||||||
|
"Port": 25,
|
||||||
|
"SenderName": "Paul Schneider",
|
||||||
|
"SenderEmail": "paul@pschneider.fr"
|
||||||
|
},
|
||||||
|
"Kestrel": {
|
||||||
|
"Endpoints": {
|
||||||
|
"web": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,8 +19,8 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.1" />
|
||||||
|
|
||||||
<PackageReference Include="MailKit" Version="2.11.1" />
|
<PackageReference Include="MailKit" Version="2.11.1" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.1" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.1" IncludeAssets="All" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" IncludeAssets="All" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" IncludeAssets="All" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" IncludeAssets="All" />
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Reference in New Issue
Block a user