Connection Strings replaced by User Profile
This commit is contained in:
1 parent
2ae5e2a68e
commit
89945fff42
3 files changed
+24
-5
No files matched your search
+4
-2
@@ -44,13 +44,15 @@ exports.newBlobStorage = function newBlobStorage(BOT, logger) {
|
||||
if (FULL_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[INFO] initialize -> environment = " + environment); }
|
||||
if (FULL_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[INFO] initialize -> containerName = " + containerName); }
|
||||
|
||||
let readConnectionString = global.STORAGE_PERMISSIONS[environment][containerName].readConnectionString;
|
||||
|
||||
|
||||
let readConnectionString = global.USER_PROFILE.storagePermissions.get(pDataOwner + "." + "READ");
|
||||
|
||||
if (readConnectionString !== undefined) {
|
||||
readOnlyBlobService = storage.createBlobService(readConnectionString);
|
||||
}
|
||||
|
||||
let writeConnectionString = global.STORAGE_PERMISSIONS[environment][containerName].writeConnectionString;
|
||||
let writeConnectionString = global.USER_PROFILE.storagePermissions.get(pDataOwner + "." + "WRITE");
|
||||
|
||||
if (writeConnectionString !== undefined) {
|
||||
writeOnlyBlobService = storage.createBlobService(writeConnectionString);
|
||||
|
||||
@@ -29,7 +29,7 @@ process.on('exit', function (code) {
|
||||
}
|
||||
});
|
||||
|
||||
global.STORAGE_PERMISSIONS = {};
|
||||
global.USER_PROFILE = {};
|
||||
|
||||
readStoragePermissions();
|
||||
|
||||
@@ -39,8 +39,23 @@ function readStoragePermissions() {
|
||||
|
||||
try {
|
||||
let fs = require('fs');
|
||||
filePath = '../' + 'Connection-Strings' + '/' + 'Storage.Permissions.json';
|
||||
global.STORAGE_PERMISSIONS = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
filePath = '../' + 'User-Profile' + '/' + 'User.Profile.json';
|
||||
global.USER_PROFILE = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
|
||||
|
||||
/* Here we will rearrange the storage permissions array into a map, so that it can be easily consumed when needed. */
|
||||
|
||||
let permissionsMap = new Map;
|
||||
|
||||
for (i = 0; i < global.USER_PROFILE.storagePermissions.length; i++) {
|
||||
|
||||
let permission = global.USER_PROFILE.storagePermissions[i];
|
||||
|
||||
permissionsMap.set(permission[0], permission[1]);
|
||||
|
||||
}
|
||||
|
||||
global.USER_PROFILE.storagePermissions = permissionsMap;
|
||||
|
||||
readExchangeAPIKey();
|
||||
}
|
||||
|
||||
@@ -946,6 +946,8 @@
|
||||
|
||||
function checkLoopHealth(pLastLoop) {
|
||||
|
||||
if (bot.startMode === 'Backtest') { return;}
|
||||
|
||||
if (bot.loopCounter <= pLastLoop + 1) { // This means that the next loop started but also stopped executing abruptally.
|
||||
|
||||
let now = new Date().valueOf();
|
||||
|
||||
Reference in new issue
Block a user