Ajustes para abertura do sistema sem a necessidade da pasta de gbapp.
This commit is contained in:
parent
e4e331730d
commit
a2ffa65425
2 changed files with 14 additions and 10 deletions
|
@ -88,7 +88,7 @@ export class GBMinService {
|
|||
|
||||
/** Constructs a new minimal instance for each bot. */
|
||||
|
||||
buildMin(cb: GBServiceCallback<GBMinInstance>, server: any, appPackages: Array<IGBPackage>) {
|
||||
buildMin(cb: GBServiceCallback<GBMinInstance>, server: any, appPackages: Array<IGBPackage>, botPackages: Array<string>) {
|
||||
|
||||
var _this_ = this;
|
||||
|
||||
|
@ -191,19 +191,23 @@ export class GBMinService {
|
|||
let p = Object.create(sysPackage.prototype) as IGBPackage;
|
||||
p.loadBot(min);
|
||||
e.sysPackages.push(p);
|
||||
|
||||
if (sysPackage.name === "GBWhatsappPackage") {
|
||||
let url = "/instances/:botId/whatsapp";
|
||||
server.post(url, (req, res) => {
|
||||
p["channel"].received(req, res);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
e.loadBot(min);
|
||||
botPackages.forEach(e => {
|
||||
[GBAdminPackage, GBAnalyticsPackage, GBCorePackage, GBSecurityPackage,
|
||||
GBKBPackage, GBCustomerSatisfactionPackage, GBWhatsappPackage].forEach(sysPackage => {
|
||||
logger.trace(`Loading sys package: ${sysPackage.name}...`);
|
||||
let p = Object.create(sysPackage.prototype) as IGBPackage;
|
||||
p.loadBot(min);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
let connector = new gBuilder.ChatConnector({
|
||||
|
@ -333,7 +337,7 @@ export class GBMinService {
|
|||
}
|
||||
|
||||
/** Performs package deployment in all .gbai or default. */
|
||||
public deployPackages(core: IGBCoreService, server: any, appPackages: Array<IGBPackage>) {
|
||||
public deployPackages(core: IGBCoreService, server: any, appPackages: Array<IGBPackage>, botPackages: Array<string>) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
|
@ -344,7 +348,6 @@ export class GBMinService {
|
|||
if (additionalPath) {
|
||||
paths = paths.concat(additionalPath.toLowerCase().split(";"));
|
||||
}
|
||||
let botPackages = new Array<string>();
|
||||
let gbappPackages = new Array<string>();
|
||||
let generalPackages = new Array<string>();
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ import { GBCustomerSatisfactionPackage } from "../deploy/customer-satisfaction.g
|
|||
import { IGBPackage } from 'botlib';
|
||||
|
||||
let appPackages = new Array<IGBPackage>();
|
||||
let botPackages = new Array<string>();
|
||||
|
||||
/**
|
||||
* General Bots open-core entry point.
|
||||
|
@ -107,12 +108,12 @@ export class GBServer {
|
|||
|
||||
(async () => {
|
||||
try {
|
||||
await minService.deployPackages(core, server, appPackages);
|
||||
await minService.deployPackages(core, server, appPackages, botPackages);
|
||||
logger.info(`The Bot Server is in RUNNING mode...`);
|
||||
|
||||
minService.buildMin(instance => {
|
||||
logger.info(`Instance loaded: ${instance.botId}...`);
|
||||
}, server, appPackages);
|
||||
}, server, appPackages, botPackages);
|
||||
|
||||
} catch (err) {
|
||||
logger.info(err);
|
||||
|
|
Loading…
Add table
Reference in a new issue