fix(core.gbapp): Self-replication on Azure
This commit is contained in:
parent
4d484d0a67
commit
f29c8c2343
6 changed files with 26 additions and 8 deletions
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -3013,9 +3013,9 @@
|
||||||
"integrity": "sha512-3BWQEbArzHkw49BCdyNxqmSnLzkrL396Q0c+VcdabT3t75wV+dc4bwzSBuLfG0KW+fBjhSR4BXM8IQfnIZU0Vg=="
|
"integrity": "sha512-3BWQEbArzHkw49BCdyNxqmSnLzkrL396Q0c+VcdabT3t75wV+dc4bwzSBuLfG0KW+fBjhSR4BXM8IQfnIZU0Vg=="
|
||||||
},
|
},
|
||||||
"botlib": {
|
"botlib": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/botlib/-/botlib-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/botlib/-/botlib-1.2.1.tgz",
|
||||||
"integrity": "sha512-JXA1LkRR8GEnb2W5/3N6H+aPnJv4b5J2XV9WiHo8zp9gW87i5g/F/wo8drDcqEfSOF2ZpHD3HyEFfbBcUY6C6A==",
|
"integrity": "sha512-r9mjcag3Ttq3m6p1pewx094Os+dNLDb6rcBiTdGQMFjjeKLzqrLL3NGusYytOGyZek13TKeVciT9aU5ZQGofEQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"async": "2.6.2",
|
"async": "2.6.2",
|
||||||
"botbuilder": "4.4.0",
|
"botbuilder": "4.4.0",
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
"botbuilder-choices": "4.0.0-preview1.2",
|
"botbuilder-choices": "4.0.0-preview1.2",
|
||||||
"botbuilder-dialogs": "4.4.0",
|
"botbuilder-dialogs": "4.4.0",
|
||||||
"botbuilder-prompts": "4.0.0-preview1.2",
|
"botbuilder-prompts": "4.0.0-preview1.2",
|
||||||
"botlib": "1.2.0",
|
"botlib": "^1.2.1",
|
||||||
"chai": "4.2.0",
|
"chai": "4.2.0",
|
||||||
"child_process": "1.0.2",
|
"child_process": "1.0.2",
|
||||||
"chokidar": "3.0.0",
|
"chokidar": "3.0.0",
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
import { GBLog, IGBCoreService, IGBInstallationDeployer, IGBInstance, IGBPackage } from 'botlib';
|
import { GBLog, IGBCoreService, IGBInstallationDeployer, IGBInstance, IGBPackage } from 'botlib';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { Sequelize } from 'sequelize-typescript';
|
import { Sequelize } from 'sequelize-typescript';
|
||||||
|
import { GBServer } from '../../../src/app';
|
||||||
import { GBAdminPackage } from '../../admin.gbapp/index';
|
import { GBAdminPackage } from '../../admin.gbapp/index';
|
||||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
||||||
import { GBAnalyticsPackage } from '../../analytics.gblib';
|
import { GBAnalyticsPackage } from '../../analytics.gblib';
|
||||||
|
@ -261,6 +262,20 @@ STORAGE_SYNC=true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public installWebHook(isGet: boolean, url: string, callback: any) {
|
||||||
|
|
||||||
|
if (isGet) {
|
||||||
|
GBServer.globals.server.get(url, (req, res) => {
|
||||||
|
callback(req, res);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
GBServer.globals.server.post(url, (req, res) => {
|
||||||
|
callback(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async saveInstance(fullInstance: any) {
|
public async saveInstance(fullInstance: any) {
|
||||||
const options = { where: {} };
|
const options = { where: {} };
|
||||||
options.where = { botId: fullInstance.botId };
|
options.where = { botId: fullInstance.botId };
|
||||||
|
|
|
@ -47,7 +47,7 @@ const graph = require('@microsoft/microsoft-graph-client');
|
||||||
import { GBError, GBLog, GBMinInstance, IGBCoreService, IGBInstance, IGBPackage } from 'botlib';
|
import { GBError, GBLog, GBMinInstance, IGBCoreService, IGBInstance, IGBPackage } from 'botlib';
|
||||||
import { AzureSearch } from 'pragmatismo-io-framework';
|
import { AzureSearch } from 'pragmatismo-io-framework';
|
||||||
import { GBServer } from '../../../src/app';
|
import { GBServer } from '../../../src/app';
|
||||||
import { GuaribasPackage, GuaribasInstance } from '../models/GBModel';
|
import { GuaribasPackage } from '../models/GBModel';
|
||||||
import { GBAdminService } from './../../admin.gbapp/services/GBAdminService';
|
import { GBAdminService } from './../../admin.gbapp/services/GBAdminService';
|
||||||
import { AzureDeployerService } from './../../azuredeployer.gbapp/services/AzureDeployerService';
|
import { AzureDeployerService } from './../../azuredeployer.gbapp/services/AzureDeployerService';
|
||||||
import { KBService } from './../../kb.gbapp/services/KBService';
|
import { KBService } from './../../kb.gbapp/services/KBService';
|
||||||
|
@ -232,7 +232,7 @@ export class GBDeployer {
|
||||||
|
|
||||||
switch (packageType) {
|
switch (packageType) {
|
||||||
case '.gbot':
|
case '.gbot':
|
||||||
await this.deployBot(localPath, min.proxyAddress);
|
await this.deployBot(localPath, GBServer.globals.publicAddress);
|
||||||
|
|
||||||
case '.gbkb':
|
case '.gbkb':
|
||||||
const service = new KBService(this.core.sequelize);
|
const service = new KBService(this.core.sequelize);
|
||||||
|
@ -371,6 +371,7 @@ export class GBDeployer {
|
||||||
GBLog.info(`Theme (.gbtheme) assets accessible at: /themes/${filenameOnly}.`);
|
GBLog.info(`Theme (.gbtheme) assets accessible at: /themes/${filenameOnly}.`);
|
||||||
} else if (Path.extname(filename) === '.gbkb') {
|
} else if (Path.extname(filename) === '.gbkb') {
|
||||||
server.use(`/kb/${filenameOnly}/subjects`, express.static(urlJoin(filename, 'subjects')));
|
server.use(`/kb/${filenameOnly}/subjects`, express.static(urlJoin(filename, 'subjects')));
|
||||||
|
server.use(`/kb/${filenameOnly}/images`, express.static(urlJoin(filename, 'images')));
|
||||||
GBLog.info(`KB (.gbkb) assets accessible at: /kb/${filenameOnly}.`);
|
GBLog.info(`KB (.gbkb) assets accessible at: /kb/${filenameOnly}.`);
|
||||||
} else if (Path.extname(filename) === '.gbui') {
|
} else if (Path.extname(filename) === '.gbui') {
|
||||||
// Already Handled
|
// Already Handled
|
||||||
|
|
|
@ -54,7 +54,7 @@ export class CSService {
|
||||||
instanceId: number,
|
instanceId: number,
|
||||||
questionTyped: string,
|
questionTyped: string,
|
||||||
questionText: string): Promise<GuaribasQuestionAlternate> {
|
questionText: string): Promise<GuaribasQuestionAlternate> {
|
||||||
return GuaribasQuestionAlternate.create({
|
return await GuaribasQuestionAlternate.create({
|
||||||
questionTyped: questionTyped,
|
questionTyped: questionTyped,
|
||||||
questionText: questionText
|
questionText: questionText
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,6 +56,7 @@ const appPackages: IGBPackage[] = [];
|
||||||
*/
|
*/
|
||||||
export class RootData {
|
export class RootData {
|
||||||
public publicAddress: string;
|
public publicAddress: string;
|
||||||
|
public server: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,6 +75,7 @@ export class GBServer {
|
||||||
GBServer.globals = new RootData();
|
GBServer.globals = new RootData();
|
||||||
const port = GBConfigService.getServerPort();
|
const port = GBConfigService.getServerPort();
|
||||||
const server = express();
|
const server = express();
|
||||||
|
GBServer.globals.server = server;
|
||||||
server.use(bodyParser.json());
|
server.use(bodyParser.json());
|
||||||
server.use(bodyParser.urlencoded({ extended: true }));
|
server.use(bodyParser.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue