First Batch of changes to support Minio together with Azure as File Providers
This commit is contained in:
1 parent
7270a52590
commit
32d4444782
11 files changed
+599
-132
No files matched your search
@@ -1,61 +0,0 @@
|
||||
exports.newBotCode = function newBotCode() {
|
||||
|
||||
let thisObject = {
|
||||
saveBotCode: saveBotCode,
|
||||
initialize: initialize
|
||||
}
|
||||
|
||||
let storage;
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pServerConfig) {
|
||||
|
||||
const STORAGE = require('../Server/Storage');
|
||||
storage = STORAGE.newStorage();
|
||||
|
||||
storage.initialize(undefined, pServerConfig);
|
||||
|
||||
}
|
||||
|
||||
function saveBotCode(pDevTeam, pSource, pRepo, pPath, pSourceCode, callBackFunction) {
|
||||
|
||||
let blobText = nodify(pSourceCode.toString());
|
||||
|
||||
storage.writeData(pDevTeam + "/" + pSource, pRepo, pPath, blobText, onDataWritten);
|
||||
|
||||
function onDataWritten(err) {
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
console.log("[ERROR] API -> saveBotCode -> Source code file could not be saved. ");
|
||||
console.log("[ERROR] API -> saveBotCode -> err.message = " + err.message);
|
||||
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
function nodify(pData) {
|
||||
|
||||
let start = pData.indexOf('function') + 9;
|
||||
let end = pData.indexOf('(') + 0;
|
||||
|
||||
let functionName = pData.substring(start, end);
|
||||
|
||||
let result = "exports." + functionName + " = " + pData;
|
||||
|
||||
result = replaceAll(result, "webRequire", "require");
|
||||
result = replaceAll(result, "window", "global");
|
||||
|
||||
return result;
|
||||
|
||||
function replaceAll(text, search, replacement) {
|
||||
return text.replace(new RegExp(search, 'g'), replacement);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,13 +12,10 @@
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pServerConfig) {
|
||||
function initialize(pServerConfig, pStorage) {
|
||||
|
||||
const STORAGE = require('../Server/Storage');
|
||||
storage = STORAGE.newStorage();
|
||||
masterAppServerURL = pServerConfig.masterAppServerURL;
|
||||
storage = pStorage;
|
||||
|
||||
storage.initialize(undefined, pServerConfig);
|
||||
}
|
||||
|
||||
function newTeam(pTeamCodeName, pTeamDisplayName, pUserName, pBotCodeName, pBotDisplayName, pUserId, callBackFunction) {
|
||||
|
||||
Reference in new issue
Block a user