Got Cloud Permissions and Exchange Keys at the Browser VM
This commit is contained in:
1 parent
3f022d0653
commit
3873d8b14c
5 files changed
+88
-6
No files matched your search
+16
-3
@@ -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) {
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
<Compile Include="AccumulatedVolumeBar.js" />
|
||||
<Compile Include="Animation.js" />
|
||||
<Compile Include="Azure\azure-storage.blob.js" />
|
||||
<Compile Include="Server\Permissions.js">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WebVM\CloudSupport.js">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user