feat: se agregan logs, y se hacen cambios en el modulo registrar mediciones

This commit is contained in:
Leonel Toro 2025-07-01 14:00:41 -04:00
parent 5bd9c2a1a6
commit 4b6204d9e7
32 changed files with 648 additions and 625 deletions

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shared.DTO.VariablesEntorno;
using Shared.DTO.VariablesEntorno;
namespace Shared.Utils
{
@ -34,8 +29,11 @@ namespace Shared.Utils
{
var dictEnv = GetVarEnviromentDict(env);
dictEnv.TryGetValue("RUTEMPRESA", out string? rutEmpresa);
CredencialDGA.RutEmpresa = rutEmpresa ?? string.Empty;
dictEnv.TryGetValue("RUTESVAL", out string? rutEsval);
CredencialDGA.RutEsval = rutEsval ?? string.Empty;
dictEnv.TryGetValue("RUTAV", out string? rutAv);
CredencialDGA.RutAv = rutAv ?? string.Empty;
dictEnv.TryGetValue("RUTUSUARIO", out string? rutUsuario);
CredencialDGA.RutUsuario = rutUsuario ?? string.Empty;
@ -79,5 +77,33 @@ namespace Shared.Utils
dictEnv.TryGetValue("ENDPOINT", out string? endpoint);
SubterraneaApiUrl.EndPoint = endpoint ?? string.Empty;
}
public static void ValidarVariablesEntorno()
{
if (string.IsNullOrWhiteSpace(CredencialDGA.RutEsval))
throw new Exception("La propiedad CredencialDGA.RutEsval está vacía o nula.");
if (string.IsNullOrWhiteSpace(CredencialDGA.RutAv))
throw new Exception("La propiedad CredencialDGA.RutAv está vacía o nula.");
if (string.IsNullOrWhiteSpace(CredencialDGA.RutUsuario))
throw new Exception("La propiedad CredencialDGA.RutUsuario está vacía o nula.");
if (string.IsNullOrWhiteSpace(CredencialDGA.Password))
throw new Exception("La propiedad CredencialDGA.Password está vacía o nula.");
if (string.IsNullOrWhiteSpace(NexusApiUrl.ApiUrl))
throw new Exception("La propiedad NexusApiUrl.ApiUrl está vacía o nula.");
if (string.IsNullOrWhiteSpace(NexusApiUrl.ApiKey))
throw new Exception("La propiedad NexusApiUrl.ApiKey está vacía o nula.");
if (string.IsNullOrWhiteSpace(NexusApiUrl.Version))
throw new Exception("La propiedad NexusApiUrl.Version está vacía o nula.");
if (string.IsNullOrWhiteSpace(NexusApiUrl.DataSource))
throw new Exception("La propiedad NexusApiUrl.DataSource está vacía o nula.");
if (string.IsNullOrWhiteSpace(NexusApiUrl.Resolution))
throw new Exception("La propiedad NexusApiUrl.Resolution está vacía o nula.");
if (string.IsNullOrWhiteSpace(BdConexion.StringConnection))
throw new Exception("La propiedad BdConexion.StringConnection está vacía o nula.");
if (string.IsNullOrWhiteSpace(SubterraneaApiUrl.BaseUrl))
throw new Exception("La propiedad SubterraneaApiUrl.BaseUrl está vacía o nula.");
if (string.IsNullOrWhiteSpace(SubterraneaApiUrl.EndPoint))
throw new Exception("La propiedad SubterraneaApiUrl.EndPoint está vacía o nula.");
}
}
}