Skip to content

Commit

Permalink
fix(core.gbapp): Entire Web stack is optional now.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Apr 3, 2020
1 parent b6e3611 commit 9652fcd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
13 changes: 8 additions & 5 deletions packages/core.gbapp/services/GBConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,15 @@ export class GBConfigService {
value = 'true';
break;
case 'REVERSE_PROXY':
value = undefined;
break;
value = undefined;
break;
case 'DISABLE_WEB':
value = "false";
break;
case 'STORAGE_ACQUIRE_TIMEOUT':
value = 40000;
break;
default:
value = 40000;
break;
default:
GBLog.warn(`Invalid key on .env file: '${key}'`);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core.gbapp/services/GBImporterService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class GBImporter {
}
const instance = await this.core.loadInstance(botId);

if (instance != null || instance.botId === null) {
if (instance != null && instance.botId === null) {
console.log(`Null BotId after load instance with botId: ${botId}.`);
}

Expand Down
10 changes: 6 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class GBServer {
const deployer: GBDeployer = new GBDeployer(core, importer);
const azureDeployer: AzureDeployerService = new AzureDeployerService(deployer);
const adminService: GBAdminService = new GBAdminService(core);


if (process.env.NODE_ENV === 'development') {
const proxy = GBConfigService.get('REVERSE_PROXY');
Expand Down Expand Up @@ -167,22 +167,24 @@ export class GBServer {
const fullInstance = Object.assign(packageInstance, GBServer.globals.bootInstance);
await core.saveInstance(fullInstance);
let instances: IGBInstance[] = await core.loadAllInstances(core, azureDeployer,
GBServer.globals.publicAddress);
GBServer.globals.publicAddress);
instances = await core.ensureInstances(instances, GBServer.globals.bootInstance, core);
if (GBServer.globals.bootInstance !== undefined) {
GBServer.globals.bootInstance = instances[0];
}

// Builds minimal service infrastructure.

const conversationalService: GBConversationalService = new GBConversationalService(core);
const minService: GBMinService = new GBMinService(core, conversationalService, adminService, deployer);
GBServer.globals.minService = minService;
await minService.buildMin(instances);

// Deployment of local applications for the first time.

deployer.setupDefaultGBUI();
if (GBConfigService.get("DISABLE_WEB") !== "true") {
deployer.setupDefaultGBUI();
}

GBLog.info(`The Bot Server is in RUNNING mode...`);

Expand Down

0 comments on commit 9652fcd

Please sign in to comment.