Переглянути джерело

Fixed legacy instance code.

pull/10/head
pb 2 роки тому
джерело
коміт
a44862578c
1 змінених файлів з 12 додано та 9 видалено
  1. 12
    9
      index.js

+ 12
- 9
index.js Переглянути файл

@@ -2309,7 +2309,7 @@ shell_verse.acquireElevationState().then((isElevated) => {
var localinstancesPath = `${instanceroot}/${p}.elxr`;
if(existsSync( localinstancesPath )) {
try {
var chessinstances = acquirelocalinstances( `${instanceroot}/${p}` )
var chessinstances = acquirelocalinstances( { root : `${instanceroot}/${p}` } )
if(chessinstances.error) delete chessinstances.error
return Object.keys(chessinstances).earlyreduce( ( reduced, instanceName) => {
return Object.keys(chessinstances[instanceName]).earlyreduce( (reduced, instanceType) => {
@@ -2349,13 +2349,16 @@ shell_verse.acquireElevationState().then((isElevated) => {
}

var cacheWriteInstanceConfig = function(chessinstances, instanceroot, selectedinstance){
var instanceName = selectedinstance.instanceName ;
var node_env = selectedinstance.node_env;
// PB : TODO -- handle current_run switch...
// console.dir(chessinstances)
// PB : TODO -- We should be able to do simply merge at a higher level using assign
chessinstances[instanceName][node_env].repos = mergeObjByKey(chessinstances[instanceName][node_env].repos || [], 'repo') ;
chessinstances[instanceName][node_env].elevated = mergeObjByKey(chessinstances[instanceName][node_env].elevated || [], 'repo') ;
if(selectedinstance) {

var instanceName = selectedinstance.instanceName ;
var node_env = selectedinstance.node_env;
// PB : TODO -- handle current_run switch...
// console.dir(chessinstances)
// PB : TODO -- We should be able to do simply merge at a higher level using assign
chessinstances[instanceName][node_env].repos = mergeObjByKey(chessinstances[instanceName][node_env].repos || [], 'repo') ;
chessinstances[instanceName][node_env].elevated = mergeObjByKey(chessinstances[instanceName][node_env].elevated || [], 'repo') ;
}
fs.writeFileSync(instanceroot + '/chessinstances.js', 'module.exports = ' + JSON.stringify(chessinstances, null, 2) + '', { 'flag': 'w' })
}

@@ -3600,7 +3603,7 @@ shell_verse.acquireElevationState().then((isElevated) => {
, selected, selectedinstance)
chessinstances[selected.instanceName][selected.node_env].reposervers = Array.from(new Set(chessinstances[selected.instanceName][selected.node_env].reposervers))
selectedinstance.reposerver = selectedinstance.reposerver || selectedinstance.reposervers[0] // PB : TODO -- Attempt first one that is available and online...
cacheWriteInstanceConfig(chessinstances, selectedinstance.root)
cacheWriteInstanceConfig(chessinstances, selectedinstance.root, selectedinstance)
// ENV.NODE_ENV = selectedinstance.node_env;
throw e
}

Завантаження…
Відмінити
Зберегти