Skip to content

Commit

Permalink
feat(core.gbapp): Development options added (ngrok)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Rodriguez (pragmatismo.io) committed Jun 26, 2019
1 parent 6fce0be commit 223801d
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 30 deletions.
2 changes: 1 addition & 1 deletion gbot.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 39 additions & 22 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion packages/core.gbapp/services/GBCoreService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions packages/core.gbapp/services/GBDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
14 changes: 10 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,16 @@ export class GBServer {
const conversationalService: GBConversationalService = new GBConversationalService(core);

if (process.env.NODE_ENV === 'development') {
// Ensure that local development proxy is setup.

GBLog.info(`Establishing a development local proxy (ngrok)...`);
GBServer.globals.publicAddress = await core.ensureProxy(port);
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}...`);
Expand Down

0 comments on commit 223801d

Please sign in to comment.