Skip to content

Commit

Permalink
Update APIController.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaropalacios-gnoss committed Jul 25, 2023
1 parent 4f49828 commit 9d88aed
Showing 1 changed file with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using ExcelDataReader;
using Gnoss.ApiWrapper;
using Gnoss.ApiWrapper.ApiModel;
using System.Threading;

namespace WoSConnect.Controllers
{
Expand All @@ -26,8 +27,37 @@ public class APIController : ControllerBase
const string pRuta = @"Files/Taxonomy.xlsx";

//Resource API.
private static ResourceApi mResourceApi = new ResourceApi($@"{System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase}Config/ConfigOAuth/OAuthV3.config");

//private static ResourceApi mResourceApi = new ResourceApi($@"{System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase}Config/ConfigOAuth/OAuthV3.config");

private static string RUTA_OAUTH = $@"{System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase}Config/ConfigOAuth/OAuthV3.config";

private static ResourceApi auxResourceApi = null;

private static ResourceApi mResourceApi
{
get
{
while (auxResourceApi == null)
{
try
{
auxResourceApi = new ResourceApi(RUTA_OAUTH);
}
catch (Exception)
{
Console.WriteLine("No se ha podido iniciar ResourceApi");
Console.WriteLine($"Contenido OAuth: {System.IO.File.ReadAllText(RUTA_OAUTH)}");
Thread.Sleep(10000);
}
}
return auxResourceApi;
}
}





public APIController(ILogger<APIController> logger)
{
_logger = logger;
Expand Down

0 comments on commit 9d88aed

Please sign in to comment.