Skip to content

Commit

Permalink
environment de dev
Browse files Browse the repository at this point in the history
  • Loading branch information
RealDream21 committed Jan 30, 2025
1 parent 44cf597 commit 52950d5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions Chir.ia_project/Chir.ia_project.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chir.ia_project", "Chir.ia_
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0D0B89B9-D1AB-4578-B3E5-7274897CEAB7}"
ProjectSection(SolutionItems) = preProject
appsettings.Development.json = appsettings.Development.json
AppSettings.json = AppSettings.json
EndProjectSection
EndProject
Expand Down
1 change: 1 addition & 0 deletions Chir.ia_project/Controllers/ListingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public async Task<IActionResult> GetById(Guid id)
}

[HttpGet]
[Authorize]
public async Task<IActionResult> IndexSwipe()
{
var userId = userManager.GetUserId(User);
Expand Down
10 changes: 9 additions & 1 deletion Chir.ia_project/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ public static class Extensions
{
public static IServiceCollection AddDbContextAndIdentity(this IServiceCollection services, IConfiguration configuration, IHostEnvironment environment)
{
services.AddDbContext<Context>(options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
if (environment.IsDevelopment())
{
services.AddDbContext<Context>(options => options.UseSqlServer(configuration.GetConnectionString("AZURE_SQL_CONNECTIONSTRING")));
}
else
{
services.AddDbContext<Context>(options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
}

services.AddRazorPages();
services.AddDefaultIdentity<User>()
.AddEntityFrameworkStores<Context>();
Expand Down
11 changes: 11 additions & 0 deletions Chir.ia_project/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"AZURE_SQL_CONNECTIONSTRING": "Data Source=chiriaserver.database.windows.net;Initial Catalog=chiria;Authentication=Active Directory Default; Encrypt=True;"
}
}
11 changes: 11 additions & 0 deletions Chir.ia_project/appsettings.Local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Data Source=(localdb)\\mssqllocaldb;Initial Catalog=Chir.ia_db;Integrated Security=True;Multiple Active Result Sets=True"
}
}

0 comments on commit 52950d5

Please sign in to comment.