This commit is contained in:
@@ -160,7 +160,7 @@ namespace Sockeye.Api.Controllers
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
GlobalBizSettingsBiz biz = GlobalBizSettingsBiz.GetBiz(ct, HttpContext);
|
||||
await biz.ImportRockfish();
|
||||
await biz.ImportRockfish(ct, log);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,19 @@ using Sockeye.Util;
|
||||
using Sockeye.Api.ControllerHelpers;
|
||||
using Sockeye.Models;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
//JSON KEY
|
||||
using Org.BouncyCastle.Security;
|
||||
using Org.BouncyCastle.OpenSsl;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Sockeye.Biz
|
||||
{
|
||||
@@ -115,12 +128,38 @@ namespace Sockeye.Biz
|
||||
|
||||
//IMPORT FROM ROCKFISH
|
||||
|
||||
public async Task ImportRockfish()
|
||||
public async Task ImportRockfish(AyContext ct, ILogger log)
|
||||
{
|
||||
//connect to rockfish
|
||||
//Authenticate to rockfish
|
||||
//string sUrl = $"{LICENSE_SERVER_URL_ROCKFISH}rvr";
|
||||
string URL_ROCKFISH = "https://rockfish.ayanova.com/";
|
||||
|
||||
try
|
||||
{
|
||||
var content = new StringContent(JsonConvert.SerializeObject(new
|
||||
{
|
||||
login = "john",
|
||||
password = "b43698c255365ee739c05ba0d42855e96c2365c76bb2f9b9eb149cec7b52174c"
|
||||
}), Encoding.UTF8, "application/json");
|
||||
var client = ServiceProviderProvider.HttpClientFactory.CreateClient();
|
||||
var res = await client.PostAsync($"{URL_ROCKFISH}/authenticate", content);
|
||||
var responseText = await res.Content.ReadAsStringAsync();
|
||||
if (res.IsSuccessStatusCode)
|
||||
{
|
||||
log.LogInformation(responseText);
|
||||
}
|
||||
else log.LogError($"E1020 - Error authenticating to rockfish: {res.ReasonPhrase}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msg = "E1020 - Error authenticating to rockfish see log for details";
|
||||
log.LogError(ex, msg);
|
||||
}
|
||||
|
||||
|
||||
//in the correct order retrieve every object and if it's not already present in sockeye, import it
|
||||
//this should be callable any time and it will just update so it can be test live in sync / parallel until ready to switch over
|
||||
await Task.CompletedTask;
|
||||
//await Task.CompletedTask;
|
||||
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user