feat(core.gbapp): Development options added (ngrok)
This commit is contained in:
parent
6fce0bef29
commit
223801da17
5 changed files with 53 additions and 29 deletions
2
gbot.cmd
2
gbot.cmd
|
@ -9,7 +9,7 @@ CALL npm install --silent
|
||||||
:COMPILE
|
:COMPILE
|
||||||
IF EXIST dist goto ALLSET
|
IF EXIST dist goto ALLSET
|
||||||
ECHO Compiling...
|
ECHO Compiling...
|
||||||
CALL tsc
|
CALL node_modules\.bin\tsc
|
||||||
|
|
||||||
:ALLSET
|
:ALLSET
|
||||||
node boot.js
|
node boot.js
|
||||||
|
|
61
package-lock.json
generated
61
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "botserver",
|
"name": "botserver",
|
||||||
"version": "1.3.0",
|
"version": "1.3.10",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -2652,6 +2652,25 @@
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
|
||||||
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
|
"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": {
|
"har-validator": {
|
||||||
"version": "5.0.3",
|
"version": "5.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
|
||||||
|
@ -2682,7 +2701,6 @@
|
||||||
"@types/node-fetch": "^1.6.7",
|
"@types/node-fetch": "^1.6.7",
|
||||||
"@types/uuid": "^3.4.3",
|
"@types/uuid": "^3.4.3",
|
||||||
"fetch-cookie": "^0.7.0",
|
"fetch-cookie": "^0.7.0",
|
||||||
"fetch-ponyfill": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
|
|
||||||
"form-data": "^2.3.2",
|
"form-data": "^2.3.2",
|
||||||
"is-buffer": "^2.0.0",
|
"is-buffer": "^2.0.0",
|
||||||
"is-stream": "^1.1.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",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
|
||||||
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
|
"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": {
|
"har-validator": {
|
||||||
"version": "5.0.3",
|
"version": "5.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
|
||||||
|
@ -2964,7 +3001,6 @@
|
||||||
"@types/node-fetch": "^1.6.7",
|
"@types/node-fetch": "^1.6.7",
|
||||||
"@types/uuid": "^3.4.3",
|
"@types/uuid": "^3.4.3",
|
||||||
"fetch-cookie": "^0.7.0",
|
"fetch-cookie": "^0.7.0",
|
||||||
"fetch-ponyfill": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db",
|
|
||||||
"form-data": "^2.3.2",
|
"form-data": "^2.3.2",
|
||||||
"is-buffer": "^2.0.0",
|
"is-buffer": "^2.0.0",
|
||||||
"is-stream": "^1.1.0",
|
"is-stream": "^1.1.0",
|
||||||
|
@ -6131,25 +6167,6 @@
|
||||||
"tough-cookie": "^2.3.1"
|
"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": {
|
"figures": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
|
||||||
|
|
|
@ -303,7 +303,8 @@ STORAGE_SYNC=true
|
||||||
try {
|
try {
|
||||||
instances = await core.loadInstances();
|
instances = await core.loadInstances();
|
||||||
const instance = instances[0];
|
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)...`);
|
GBLog.info(`Updating bot endpoint to local reverse proxy (ngrok)...`);
|
||||||
try {
|
try {
|
||||||
await installationDeployer.updateBotProxy(
|
await installationDeployer.updateBotProxy(
|
||||||
|
|
|
@ -137,7 +137,7 @@ export class GBDeployer {
|
||||||
|
|
||||||
WaitUntil()
|
WaitUntil()
|
||||||
.interval(1000)
|
.interval(1000)
|
||||||
.times(10)
|
.times(5)
|
||||||
.condition(cb => {
|
.condition(cb => {
|
||||||
GBLog.info(`Waiting for app package deployment...`);
|
GBLog.info(`Waiting for app package deployment...`);
|
||||||
cb(appPackagesProcessed === gbappPackages.length);
|
cb(appPackagesProcessed === gbappPackages.length);
|
||||||
|
@ -432,7 +432,7 @@ export class GBDeployer {
|
||||||
GBLog.info(`Compiling ${e}...`);
|
GBLog.info(`Compiling ${e}...`);
|
||||||
|
|
||||||
try {
|
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)
|
import(e)
|
||||||
.then(m => {
|
.then(m => {
|
||||||
const p = new m.Package();
|
const p = new m.Package();
|
||||||
|
|
12
src/app.ts
12
src/app.ts
|
@ -97,10 +97,16 @@ export class GBServer {
|
||||||
const conversationalService: GBConversationalService = new GBConversationalService(core);
|
const conversationalService: GBConversationalService = new GBConversationalService(core);
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// Ensure that local development proxy is setup.
|
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)...`);
|
GBLog.info(`Establishing a development local proxy (ngrok)...`);
|
||||||
GBServer.globals.publicAddress = await core.ensureProxy(port);
|
GBServer.globals.publicAddress = await core.ensureProxy(port);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const serverAddress = `https://${process.env.WEBSITE_SITE_NAME}.azurewebsites.net`;
|
const serverAddress = `https://${process.env.WEBSITE_SITE_NAME}.azurewebsites.net`;
|
||||||
GBLog.info(`Defining server address at ${serverAddress}...`);
|
GBLog.info(`Defining server address at ${serverAddress}...`);
|
||||||
|
|
Loading…
Add table
Reference in a new issue