fix log variables de entorno
This commit is contained in:
parent
fee40a25a4
commit
ca6f3cec82
4 changed files with 33 additions and 4 deletions
|
@ -14,6 +14,16 @@ namespace Integracion_DGA
|
|||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
IConfiguration configuration;
|
||||
|
||||
configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
FileLoggerHelper.ConfigureLogger(configuration);
|
||||
|
||||
try
|
||||
{
|
||||
Console.Write("Obteniendo variables de entorno...");
|
||||
|
@ -35,9 +45,7 @@ namespace Integracion_DGA
|
|||
using IHost host = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureServices((context, services) =>
|
||||
{
|
||||
IConfiguration configuration = context.Configuration;
|
||||
services.AddSingleton<IConfiguration>(configuration);
|
||||
|
||||
services.AddScoped<MedicionScadaRepository>();
|
||||
services.AddScoped<EnvioDGA>();
|
||||
services.AddHttpClient<RegistrarMedicion>();
|
||||
|
|
|
@ -14,6 +14,16 @@ namespace Recuperacion_DGA
|
|||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
IConfiguration configuration;
|
||||
|
||||
configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
FileLoggerHelper.ConfigureLogger(configuration);
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine("Obteniendo variables de entorno...");
|
||||
|
@ -35,9 +45,7 @@ namespace Recuperacion_DGA
|
|||
using IHost host = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureServices((context, services) =>
|
||||
{
|
||||
IConfiguration configuration = context.Configuration;
|
||||
services.AddSingleton<IConfiguration>(configuration);
|
||||
|
||||
services.AddScoped<MedicionScadaRepository>();
|
||||
services.AddScoped<EnvioDGA>();
|
||||
services.AddHttpClient<RegistrarMedicion>();
|
||||
|
|
|
@ -20,4 +20,10 @@
|
|||
<ProjectReference Include="..\SHARED\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
7
Recuperacion_DGA/appsettings.json
Normal file
7
Recuperacion_DGA/appsettings.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogFile": {
|
||||
"Path": "logs/log.txt"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue