diff --git a/Ecosystem.js b/Ecosystem.js
index 11a633278..19e8eaaba 100644
--- a/Ecosystem.js
+++ b/Ecosystem.js
@@ -1,7 +1,7 @@
function newEcosystem() {
- let ecosystem = {
+ let thisObject = {
getHost: getHost,
getCompetition: getCompetition,
getTeam: getTeam,
@@ -12,17 +12,30 @@ function newEcosystem() {
getExchange: getExchange,
getPlotter: getPlotter,
getPlotterModule: getPlotterModule,
+ getStoragePermissions: getStoragePermissions,
+ getExchangeKeys: getExchangeKeys,
initialize: initialize
}
const ECOSYSTEM = "@ecosystem.json@";
- return ecosystem;
-
+ return thisObject;
function initialize() {
+ }
+
+ function getStoragePermissions() {
+
+ return ECOSYSTEM.STORAGE_PERMISSIONS;
+
+ }
+
+ function getExchangeKeys() {
+
+ return ECOSYSTEM.EXCHANGE_KEYS;
+
}
function getHost(pHostCodeName) {
diff --git a/Project.njsproj b/Project.njsproj
index 1c0978988..0731d3a4a 100644
--- a/Project.njsproj
+++ b/Project.njsproj
@@ -32,6 +32,9 @@
+
+ Code
+
Code
diff --git a/Server/Permissions.js b/Server/Permissions.js
new file mode 100644
index 000000000..c7c0c2e25
--- /dev/null
+++ b/Server/Permissions.js
@@ -0,0 +1,54 @@
+exports.newPermissions = function newPermissions() {
+
+ let thisObject = {
+ initialize: initialize
+ }
+
+ return thisObject;
+
+ function initialize(pEcosystemObject, callBackFunction) {
+
+ readStoragePermissions();
+
+ function readStoragePermissions() {
+
+ let filePath;
+
+ try {
+ let fs = require('fs');
+ filePath = '../' + 'Connection-Strings' + '/' + 'Storage.Permissions.json';
+ pEcosystemObject.STORAGE_PERMISSIONS = JSON.parse(fs.readFileSync(filePath, 'utf8'));
+
+ readExchangeAPIKey();
+ }
+ catch (err) {
+ console.log("[ERROR] readStoragePermissions -> err = " + err.message);
+ console.log("[HINT] readStoragePermissions -> You need to have a file at this path -> " + filePath);
+ }
+ }
+
+ function readExchangeAPIKey() {
+
+ try {
+ let fs = require('fs');
+ let filePath = '../' + 'Exchange-Keys' + '/' + 'Secret.Keys' + '.json';
+
+ pEcosystemObject.EXCHANGE_KEYS = JSON.parse(fs.readFileSync(filePath, 'utf8'));
+ callBackFunction();
+ }
+ catch (err) {
+ console.log("[ERROR] readExchangeAPIKey -> err = " + err.message);
+ console.log("[HINT] You need to have a file at this path -> " + filePath);
+
+ pEcosystemObject.EXCHANGE_KEYS = {
+ Poloniex: {
+ Key: "",
+ Secret: ""
+ }
+ }
+
+ callBackFunction();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/WebVM/CloudSupport.js b/WebVM/CloudSupport.js
index 6a9382982..43ba3adb5 100644
--- a/WebVM/CloudSupport.js
+++ b/WebVM/CloudSupport.js
@@ -7,10 +7,14 @@ When running at the clode on NodeJS some things work diffently that at the brows
*/
-window.CURRENT_ENVIRONMENT = "Develop";
+
function runBot() {
+ window.CURRENT_ENVIRONMENT = "Develop";
+ window.STORAGE_PERMISSIONS = ecosystem.getStoragePermissions();
+ window.EXCHANGE_KEYS = ecosystem.getExchangeKeys();
+
let root = newRoot();
root.initialize();
diff --git a/server.js b/server.js
index a9ea1fe9f..a3cbde240 100644
--- a/server.js
+++ b/server.js
@@ -70,9 +70,17 @@ function initialize() {
function onLoadCompeted(pHTMLCloudScripts) {
- HTMLCloudScripts = pHTMLCloudScripts;
- startHtttpServer();
+ const PERMISSIONS = require('./Server/Permissions');
+ let permissions = PERMISSIONS.newPermissions();
+ permissions.initialize(ecosystemObject, onInitialized);
+
+ function onInitialized() {
+
+ HTMLCloudScripts = pHTMLCloudScripts;
+ startHtttpServer();
+
+ }
}
}
}