Move config-getting to VectorBasePlatform

in Electron get config via IPC from main process
which has access to the "local" config.json override file
and can make people happy :D

Remove bunch of duplicated code,
and move comments around to put them in the right place

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-06-26 21:08:04 +01:00
parent fceb05e646
commit 974797648f
5 changed files with 22 additions and 40 deletions

View file

@ -17,6 +17,8 @@ limitations under the License.
import Promise from 'bluebird';
import request from 'browser-request';
// Load the config file. First try to load up a domain-specific config of the
// form "config.$domain.json" and if that fails, fall back to config.json.
export async function getVectorConfig(relativeLocation) {
if (relativeLocation === undefined) relativeLocation = '';
if (relativeLocation !== '' && !relativeLocation.endsWith('/')) relativeLocation += '/';
@ -32,7 +34,7 @@ export async function getVectorConfig(relativeLocation) {
}
}
function getConfig(configJsonFilename) {
export function getConfig(configJsonFilename) {
return new Promise(function(resolve, reject) {
request(
{ method: "GET", url: configJsonFilename },