feat(core.gbapp): Development options added (ngrok)

This commit is contained in:
Rodrigo Rodriguez (pragmatismo.io) 2019-06-26 13:18:15 -03:00
parent 6fce0bef29
commit 223801da17
5 changed files with 53 additions and 29 deletions

View file

@ -9,7 +9,7 @@ CALL npm install --silent
:COMPILE
IF EXIST dist goto ALLSET
ECHO Compiling...
CALL tsc
CALL node_modules\.bin\tsc
:ALLSET
node boot.js

61
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "botserver",
"version": "1.3.0",
"version": "1.3.10",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -2652,6 +2652,25 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"fetch-ponyfill": {
"version": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
"from": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
"requires": {
"fetch-cookie": "~0.6.0",
"node-fetch": "~1.7.1"
},
"dependencies": {
"fetch-cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.6.0.tgz",
"integrity": "sha1-T+xOQIzAAH9sBOVTYYr0s97jf2k=",
"requires": {
"es6-denodeify": "^0.1.1",
"tough-cookie": "^2.3.1"
}
}
}
},
"har-validator": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
@ -2682,7 +2701,6 @@
"@types/node-fetch": "^1.6.7",
"@types/uuid": "^3.4.3",
"fetch-cookie": "^0.7.0",
"fetch-ponyfill": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
"form-data": "^2.3.2",
"is-buffer": "^2.0.0",
"is-stream": "^1.1.0",
@ -2934,6 +2952,25 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"fetch-ponyfill": {
"version": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
"from": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
"requires": {
"fetch-cookie": "~0.6.0",
"node-fetch": "~1.7.1"
},
"dependencies": {
"fetch-cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.6.0.tgz",
"integrity": "sha1-T+xOQIzAAH9sBOVTYYr0s97jf2k=",
"requires": {
"es6-denodeify": "^0.1.1",
"tough-cookie": "^2.3.1"
}
}
}
},
"har-validator": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
@ -2964,7 +3001,6 @@
"@types/node-fetch": "^1.6.7",
"@types/uuid": "^3.4.3",
"fetch-cookie": "^0.7.0",
"fetch-ponyfill": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
"form-data": "^2.3.2",
"is-buffer": "^2.0.0",
"is-stream": "^1.1.0",
@ -6131,25 +6167,6 @@
"tough-cookie": "^2.3.1"
}
},
"fetch-ponyfill": {
"version": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
"from": "github:amarzavery/fetch-ponyfill#master",
"requires": {
"fetch-cookie": "~0.6.0",
"node-fetch": "~1.7.1"
},
"dependencies": {
"fetch-cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.6.0.tgz",
"integrity": "sha1-T+xOQIzAAH9sBOVTYYr0s97jf2k=",
"requires": {
"es6-denodeify": "^0.1.1",
"tough-cookie": "^2.3.1"
}
}
}
},
"figures": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",

View file

@ -303,7 +303,8 @@ STORAGE_SYNC=true
try {
instances = await core.loadInstances();
const instance = instances[0];
if (process.env.NODE_ENV === 'development') {
if (process.env.NODE_ENV === 'development' &&
GBConfigService.get('REVERSE_PROXY') === undefined) {
GBLog.info(`Updating bot endpoint to local reverse proxy (ngrok)...`);
try {
await installationDeployer.updateBotProxy(

View file

@ -137,7 +137,7 @@ export class GBDeployer {
WaitUntil()
.interval(1000)
.times(10)
.times(5)
.condition(cb => {
GBLog.info(`Waiting for app package deployment...`);
cb(appPackagesProcessed === gbappPackages.length);
@ -432,7 +432,7 @@ export class GBDeployer {
GBLog.info(`Compiling ${e}...`);
try {
child_process.execSync(Path.join(e, 'node_modules/.bin/tsc'), { cwd: e });
child_process.execSync(Path.join(process.env.PWD, 'node_modules/.bin/tsc'), { cwd: e });
import(e)
.then(m => {
const p = new m.Package();

View file

@ -97,10 +97,16 @@ export class GBServer {
const conversationalService: GBConversationalService = new GBConversationalService(core);
if (process.env.NODE_ENV === 'development') {
const proxy = GBConfigService.get('REVERSE_PROXY');
if (proxy !== undefined) {
GBServer.globals.publicAddress = proxy;
}
else {
// Ensure that local development proxy is setup.
GBLog.info(`Establishing a development local proxy (ngrok)...`);
GBServer.globals.publicAddress = await core.ensureProxy(port);
}
} else {
const serverAddress = `https://${process.env.WEBSITE_SITE_NAME}.azurewebsites.net`;
GBLog.info(`Defining server address at ${serverAddress}...`);