Commit 21ee2c22 authored by tobias's avatar tobias Committed by yPhil
Browse files

Port selection

parent a050d957
......@@ -7,5 +7,5 @@ job1:
stage: build
script:
- npm install
- npm start
- npm run coverage
- PORT=8000 npm start
- PORT=8000 npm run coverage
......@@ -39,6 +39,8 @@ git clone https://framagit.org/yphil/petrolette
cd petrolette
npm install
npm start
# to use a custom port
#PORT=XXXX npm start
xdg-open http://localhost:8000
```
......
......@@ -5,7 +5,10 @@ const petrolette = require('../petrolette'),
const httpServer = http.createServer(petrolette);
httpServer.listen(8000, () => {
/* look for port in environment variable */
const port = parseInt(process.env["PORT"]) || 8000;
httpServer.listen(port, () => {
console.debug('HTTP Server running');
});
......
......@@ -7,11 +7,9 @@
"ignore_watch" : ["#*", "favicons-cache", ".git", "node_modules"],
"time" : false,
"env" : {
"PORT" : 8000,
"NODE_ENV": "dev"
},
"env_ssl" : {
"PORT" : 8080,
"NODE_ENV": "ssl"
}
}
......
......@@ -3,6 +3,8 @@ const should = require('should'),
pjson = require('../package.json'),
fetch = require('node-fetch');
const PORT = process.env.PORT;
describe('Pétrolette', function() {
it('Favicon cache dir exists', function(done) {
......@@ -20,7 +22,7 @@ describe('Pétrolette', function() {
});
it('Pétrolette server is running', function(done) {
fetch('http://localhost:8000')
fetch('http://localhost:'+ PORT)
.then(function (res) {
res.status.should.eql(200);
done();
......@@ -28,7 +30,7 @@ describe('Pétrolette', function() {
});
it('Pétrolette is returning a feed', function(done) {
fetch('http://localhost:8000/discover/?url=http://lemonde.fr')
fetch('http://localhost:'+PORT+'/discover/?url=http://lemonde.fr')
.then(async res => {
await res.text().should.eventually.eql('https://www.lemonde.fr/rss/une.xml');
}).catch(done);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment