Skip to content

Commit

Permalink
fix(core.gbapp): Clean-up of system code
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-parana committed Oct 18, 2019
1 parent 27dcdfc commit 9311943
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core.gbapp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
import { Sequelize } from 'sequelize-typescript';
import { SwitchBotDialog } from './dialogs/SwitchBot';
import { WelcomeDialog } from './dialogs/WelcomeDialog';
import { WhoAmIDialog } from './dialogs/WhoAmIDialog';
import { GuaribasChannel, GuaribasException, GuaribasInstance, GuaribasPackage } from './models/GBModel';
import { SwitchBotDialog } from './dialogs/SwitchBot';

/**
* Package for core.gbapp.
Expand Down
2 changes: 1 addition & 1 deletion packages/core.gbapp/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Messages = {
good_night: 'boa noite',
hi: (msg) => `Oi, ${msg}.`,
very_sorry_about_error: `Lamento, ocorreu um erro que já foi registrado para ser tratado.`,
global_quit: /^(sair|Sair)/i,
global_quit: /^(sair|Sair)/i,
canceled: 'Cancelado, avise como posso ser útil novamente.'
}
};
Empty file.
2 changes: 0 additions & 2 deletions packages/whatsapp.gblib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import { WhatsappDirectLine } from './services/WhatsappDirectLine';
export class GBWhatsappPackage implements IGBPackage {
public sysPackages: IGBPackage[];


public loadBot(min: GBMinInstance): void {
// Only loads engine if it is defined on services.json.

Expand All @@ -61,7 +60,6 @@ export class GBWhatsappPackage implements IGBPackage {
}
}


public getDialogs(min: GBMinInstance) {
GBLog.verbose(`getDialogs called.`);
}
Expand Down
33 changes: 16 additions & 17 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
const express = require('express');
const bodyParser = require('body-parser');
import * as fs from 'fs';
var mkdirp = require('mkdirp');
var Path = require('path');
let mkdirp = require('mkdirp');
let Path = require('path');

import { GBLog, IGBCoreService, IGBInstance, IGBPackage, GBMinInstance } from 'botlib';
import { GBLog, GBMinInstance, IGBCoreService, IGBInstance, IGBPackage } from 'botlib';
import { GBAdminService } from '../packages/admin.gbapp/services/GBAdminService';
import { AzureDeployerService } from '../packages/azuredeployer.gbapp/services/AzureDeployerService';
import { GBConfigService } from '../packages/core.gbapp/services/GBConfigService';
Expand All @@ -56,14 +56,14 @@ import { GBMinService } from '../packages/core.gbapp/services/GBMinService';
* Global shared server data;
*/
export class RootData {
public publicAddress: string;
public server: any;
public sysPackages: any[];
public appPackages: any[];
minService: GBMinService;
bootInstance: IGBInstance;
public minInstances: any[];
minBoot: GBMinInstance;
public publicAddress: string; // URI for BotServer
public server: any; // Express reference
public sysPackages: any[]; // Loaded system package list
public appPackages: any[]; // Loaded .gbapp package list
public minService: GBMinService; // Minimalist service core
public bootInstance: IGBInstance; // General Bot Interface Instance
public minInstances: any[]; //
public minBoot: GBMinInstance;
}

/**
Expand Down Expand Up @@ -93,10 +93,10 @@ export class GBServer {

// Creates working directory.

const workDir = Path.join(process.env.PWD, 'work');
if (!fs.existsSync(workDir)){
const workDir = Path.join(process.env.PWD, 'work');
if (!fs.existsSync(workDir)) {
mkdirp.sync(workDir);
}
}

server.listen(port, () => {
(async () => {
Expand All @@ -116,8 +116,7 @@ export class GBServer {
const proxy = GBConfigService.get('REVERSE_PROXY');
if (proxy !== undefined) {
GBServer.globals.publicAddress = proxy;
}
else {
} else {
// Ensure that local development proxy is setup.

GBLog.info(`Establishing a development local proxy (ngrok)...`);
Expand Down Expand Up @@ -163,7 +162,7 @@ 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];
Expand Down

0 comments on commit 9311943

Please sign in to comment.