Skip to content

Commit

Permalink
Merge pull request #95 from jhonabreul/refactor-subscription-validation
Browse files Browse the repository at this point in the history
Use Globals for credentials access for subscription validation
  • Loading branch information
jhonabreul authored Feb 21, 2024
2 parents 1863a02 + 6bf474c commit f7f2fd3
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,9 @@ private void Initialize(
{
return;
}

ValidateSubscription();

_isInitialized = true;
_loadExistingHoldings = loadExistingHoldings;
_algorithm = algorithm;
Expand Down Expand Up @@ -1304,8 +1307,6 @@ private void Initialize(
_connectEvent.Set();
};

ValidateSubscription();

// initialize our heart beat thread
RunHeartBeatThread();

Expand Down Expand Up @@ -4879,9 +4880,9 @@ private static void ValidateSubscription()
try
{
var productId = 181;
var userId = Config.GetInt("job-user-id");
var token = Config.Get("api-access-token");
var organizationId = Config.Get("job-organization-id", null);
var userId = Globals.UserId;
var token = Globals.UserToken;
var organizationId = Globals.OrganizationID;
// Verify we can authenticate with this user and token
var api = new ApiConnection(userId, token);
if (!api.Connected)
Expand Down

0 comments on commit f7f2fd3

Please sign in to comment.