cambios variables de ambiente

This commit is contained in:
bcastrogallardo 2025-07-01 09:59:59 -04:00
parent 222d5fdc08
commit 0d67a44d36
20 changed files with 261 additions and 297 deletions

View file

@ -1,10 +1,11 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration;
using BLL.Integracion_DGA;
using BLL.Recuperacion_DGA;
using DAL;
using DAS;
using BLL.Recuperacion_DGA;
using BLL.Integracion_DGA;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shared.Utils;
namespace Recuperacion_DGA
{
@ -12,6 +13,11 @@ namespace Recuperacion_DGA
{
static async Task Main(string[] args)
{
ObtenerVariablesEntorno.AmbientarApiUrlNexus("NEXUS_API_URL");
ObtenerVariablesEntorno.AmbientarUrlApiSubterranea("SUBTERRANEAS_API_URL");
ObtenerVariablesEntorno.AmbientarConexionBd("CONEXION_BD_ENVIO_DGA");
ObtenerVariablesEntorno.AmbientarCredencialesDGA("DGA_CREDENCIALES");
using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
{
@ -25,15 +31,19 @@ namespace Recuperacion_DGA
services.AddScoped<JobsDgaRepository>();
services.AddScoped<JobsDgaVilosRepository>();
services.AddScoped<JobsDgaSupFlujRepository>();
services.AddScoped<LogMedicionScadaRepository>();
services.AddScoped<ApiService>();
services.AddScoped<BusinessLogic>();
})
.Build();
var envioDGA = host.Services.GetRequiredService<EnvioDGA>();
var mediciones = await envioDGA.ObtenerMedicionesAsync();
//TODO: Controlar si las variables de ambiente existen
//TODO: Log de texto
Console.WriteLine($"Se obtuvieron {mediciones.Count} registros.");
var envioDGA = host.Services.GetRequiredService<EnvioDGA>();
await envioDGA.RegistrarMedicionesAsync();
//TODO: Log de texto
}
}
}