From 81308c2f79d06abca9fe686b0f6b8397a74c6242 Mon Sep 17 00:00:00 2001 From: Leandro Hernan Rojas Date: Tue, 28 Jan 2025 18:56:36 -0300 Subject: [PATCH] Ajustes de VSCode Confirmacion --- .vscode/launch.json | 28 ++++++++++++++++++++++ .vscode/tasks.json | 16 +++++++++++++ phronCare.API/Program.cs | 7 ++++++ phronCare.API/appsettings.Development.json | 8 ------- phronCare.API/phronCare.API.csproj | 5 ++++ 5 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json delete mode 100644 phronCare.API/appsettings.Development.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..971faee --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch phronCare API", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/phronCare.API/bin/Debug/net8.0/phronCare.API.dll", + "args": [], + "cwd": "${workspaceFolder}/phronCare.API", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)", + "uriFormat": "%s/swagger/index.html" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_CONFIGURATION": "appsettings.json" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + } + } + ] + } + \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..0a0aeff --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/phronCare/phronCare.API/phronCare.API.csproj" + ], + "problemMatcher": "$msCompile" + } + ] + } + \ No newline at end of file diff --git a/phronCare.API/Program.cs b/phronCare.API/Program.cs index b24744a..9175f05 100644 --- a/phronCare.API/Program.cs +++ b/phronCare.API/Program.cs @@ -16,6 +16,9 @@ using Services.Interfaces; using System.Text; var builder = WebApplication.CreateBuilder(args); +// Asegúrate de que el archivo appsettings.json se cargue correctamente +builder.Configuration.SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); #region DbContext Identity Configuration var configuration = builder.Configuration; @@ -69,6 +72,10 @@ builder.Services.AddAuthentication(options => #region Email Configuration var emailConfig = configuration.GetSection("EmailConfiguration").Get(); +if (emailConfig == null) +{ + throw new InvalidOperationException("La configuración del correo electrónico no se encontró o es inválida."); +} builder.Services.AddSingleton(emailConfig); builder.Services.AddScoped(); #endregion diff --git a/phronCare.API/appsettings.Development.json b/phronCare.API/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/phronCare.API/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/phronCare.API/phronCare.API.csproj b/phronCare.API/phronCare.API.csproj index aac3d9f..3d9df95 100644 --- a/phronCare.API/phronCare.API.csproj +++ b/phronCare.API/phronCare.API.csproj @@ -43,5 +43,10 @@ + + + PreserveNewest + +