From ff69195d2ea2b745607ef517bdb41d95a4286a2c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 16 Nov 2018 12:56:31 +0100 Subject: [PATCH 1/3] Storage Permissions now at server.config file --- Server/StorageAccessManager.js | 24 +++--------------------- server.js | 2 +- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/Server/StorageAccessManager.js b/Server/StorageAccessManager.js index 3980a259a..22ef04405 100644 --- a/Server/StorageAccessManager.js +++ b/Server/StorageAccessManager.js @@ -9,29 +9,11 @@ return thisObject; - function initialize(callBackFunction) { + function initialize(pServerConfig, callBackFunction) { - readStoragePermissions(); + permissions = pServerConfig.storagePermissions; - function readStoragePermissions() { - - let filePath; - - try { - let fs = require('fs'); - filePath = './' + 'Storage' + '/' + 'Storage.Permissions.json'; - permissions = JSON.parse(fs.readFileSync(filePath, 'utf8')); - - callBackFunction(); - - } - catch (err) { - console.log("[ERROR] readStoragePermissions -> err = " + err.message); - console.log("[HINT] readStoragePermissions -> You need to have a file at this path -> " + filePath); - - callBackFunction(); - } - } + callBackFunction(); } function getPermission(pContainer, pType, pDays) { diff --git a/server.js b/server.js index f1dc52194..66d16de6e 100644 --- a/server.js +++ b/server.js @@ -135,7 +135,7 @@ function initialize() { const STORAGE_ACCESS_MANAGER = require('./Server/StorageAccessManager'); storageAccessManager = STORAGE_ACCESS_MANAGER.newStorageAccessManager(); - storageAccessManager.initialize(onInitialized); + storageAccessManager.initialize(serverConfig, onInitialized); function onInitialized() { From d20c8794c56ac48d684df82d5cc458815d91d79f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 16 Nov 2018 13:05:36 +0100 Subject: [PATCH 2/3] Storage Permissions improved --- Server/StorageAccessManager.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Server/StorageAccessManager.js b/Server/StorageAccessManager.js index 22ef04405..d31b13d9d 100644 --- a/Server/StorageAccessManager.js +++ b/Server/StorageAccessManager.js @@ -5,13 +5,26 @@ initialize: initialize } - let permissions; + let connectionString; return thisObject; - function initialize(pServerConfig, callBackFunction) { + function initialize(serverConfig, callBackFunction) { - permissions = pServerConfig.storagePermissions; + switch (serverConfig.environment) { + + case "Develop": { + + connectionString = serverConfig.configAndPlugins.Develop.connectionString; + break; + } + + case "Production": { + + connectionString = serverConfig.configAndPlugins.Production.connectionString; + break; + } + } callBackFunction(); } @@ -19,7 +32,7 @@ function getPermission(pContainer, pType, pDays) { let azure = require('azure-storage'); - let blobService = azure.createBlobService(permissions.connectionString); + let blobService = azure.createBlobService(connectionString); let startDate = new Date(); startDate.setDate(startDate.getDate() - 1); From f47ff3b832db154725792630b3d1241bc958160f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 17 Nov 2018 08:09:25 +0100 Subject: [PATCH 3/3] Pointing to local in a file only used on development --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 18fab8db6..b39e663b4 100644 --- a/index.html +++ b/index.html @@ -16,7 +16,7 @@ executingAt: 'Master App', visible: true, topMargin: 85, - urlPrefix: 'https://charts-dev.advancedalgos.net/', /* 'http://localhost:1337/' */ /* 'https://charts-dev.advancedalgos.net/' */ + urlPrefix: 'http://localhost:1337/', /* 'http://localhost:1337/' */ /* 'https://charts-dev.advancedalgos.net/' */ graphQL: { masterAppApiUrl: 'https://app-api.advancedalgos.net/graphql' },