Skip to content

Commit

Permalink
fix(core.gbapp): Self-replication on Azure
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed May 27, 2019
1 parent 3cca504 commit bf602c6
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 29 deletions.
16 changes: 11 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
"type": "node",
"request": "launch",
"name": "Debug Program",
"program": "${workspaceRoot}/dist/src/app.js",
"program": "${workspaceRoot}/boot.js",
"cwd": "${workspaceRoot}",
"env": {
"NODE_ENV": "development"
},
"args":["--no-deprecation"],
"skipFiles": ["node_modules/**/*.js"],
"outFiles": ["${workspaceRoot}/dist/*.js"],
"args": [
"--no-deprecation"
],
"skipFiles": [
"node_modules/**/*.js"
],
"outFiles": [
"${workspaceRoot}/dist/*.js"
],
"stopOnEntry": false,
"console": "integratedTerminal"
}
]
}
}
4 changes: 4 additions & 0 deletions boot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin / env node
const GBServer = require("./dist/src/app").GBServer
process.env.PWD = __dirname;
GBServer.run();
2 changes: 1 addition & 1 deletion gbot.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ ECHO Compiling...
CALL tsc

:ALLSET
node dist/src/app.js
node app.js
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "botserver",
"version": "1.3.0",
"description": "General Bot Community Edition open-core server.",
"main": "./src/app.ts",
"main": "./boot.js",
"bugs": "https://github.com/pragmatismo-io/BotServer/issues",
"homepage": "https://github.com/pragmatismo-io/BotServer/#readme",
"contributors": [
Expand All @@ -15,7 +15,7 @@
"license": "AGPL-3.0",
"preferGlobal": true,
"bin": {
"gbot": "./dist/src/app.js"
"gbot": "./boot.js"
},
"repository": {
"type": "git",
Expand All @@ -31,7 +31,7 @@
"test": "nyc --reporter=html --reporter=text mocha -r ts-node/register packages/**/*.test.ts ",
"pretest": "npm run build",
"coveralls": "npm run test && nyc report --reporter=text-lcov | coveralls",
"start": "node ./dist/src/app.js",
"start": "node ./boot.js",
"watch:build": "tsc --watch",
"watch:server": "nodemon './dist/index.js' --watch './dist'",
"posttypedoc": "shx cp .nojekyll docs/reference/.nojekyll",
Expand Down Expand Up @@ -245,4 +245,4 @@
"post-merge": []
}
}
}
}
2 changes: 1 addition & 1 deletion packages/core.gbapp/services/GBDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class GBDeployer {
(resolve: any, reject: any): any => {
GBLog.info(`PWD ${process.env.PWD}...`);
let totalPackages = 0;
let paths = [urlJoin(process.env.PWD, '..', GBDeployer.deployFolder)];
let paths = [urlJoin(process.env.PWD, GBDeployer.deployFolder)];
const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH');
if (additionalPath !== undefined && additionalPath !== '') {
paths = paths.concat(additionalPath.toLowerCase().split(';'));
Expand Down
15 changes: 1 addition & 14 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#! /usr/bin / env node
/*****************************************************************************\
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
Expand Down Expand Up @@ -72,19 +71,11 @@ export class GBServer {

public static run() {
GBLog.info(`The Bot Server is in STARTING mode...`);
process.env.PWD = __dirname;

// Creates a basic HTTP server that will serve several URL, one for each bot instance.

GBServer.globals = new RootData();
const port = GBConfigService.getServerPort();
const server = express();
server.use(bodyParser.json());
server.use(
bodyParser.urlencoded({
extended: true
})
);
server.use(bodyParser.urlencoded({ extended: true }));

server.listen(port, () => {
(async () => {
Expand Down Expand Up @@ -171,7 +162,3 @@ export class GBServer {
});
}
}

// First line to run.

GBServer.run();
6 changes: 2 additions & 4 deletions web.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="dist/src/app.js" verb="*" modules="iisnode"/>
<add name="iisnode" path="boot.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
Expand All @@ -19,7 +19,7 @@
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="dist/src/app.js"/>
<action type="Rewrite" url="boot.js"/>
</rule>
</rules>
</rewrite>
Expand All @@ -35,5 +35,3 @@
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>


0 comments on commit bf602c6

Please sign in to comment.