Skip to content

Commit

Permalink
Merge pull request nightscout#2 from nightscout/master
Browse files Browse the repository at this point in the history
master
  • Loading branch information
iost1 authored Feb 23, 2017
2 parents e1e07e5 + 9a92420 commit 5f9994d
Show file tree
Hide file tree
Showing 221 changed files with 23,562 additions and 3,958 deletions.
19 changes: 17 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
language: node_js
sudo: false
node_js:
- "0.10"
- "0.12"
- 0.10
- 0.12
- 4
- 5
matrix:
fast_finish: true
allow_failures:
- node_js: 4
- node_js: 5
services: mongodb
script: make travis
after_script: make report
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,8 @@ appropriate.

## Co-ordination

There is a google groups nightscout-core developers list where lots of
people discuss Nightscout. Most cgm-remote-monitor hackers use
github's ticketing system, along with Facebook cgm-in-the-cloud, and
gitter system.
Most cgm-remote-monitor hackers use github's ticketing system, along with Facebook cgm-in-the-cloud, and
gitter.

We use git-flow, with `master` as our production, stable branch, and
`dev` is used to queue up for upcoming releases. Everything else is
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ report:
(npm install coveralls && cat ${ANALYZED} | \
./node_modules/.bin/coveralls) || echo "NO COVERAGE"
test -f ${ANALYZED} && \
(npm install codecov.io && cat ${ANALYZED} | \
./node_modules/codecov.io/bin/codecov.io.js) || echo "NO COVERAGE"
test -f ${ANALYZED} && \
(npm install codacy-coverage && cat ${ANALYZED} | \
YOURPACKAGE_COVERAGE=1 ./node_modules/codacy-coverage/bin/codacy-coverage.js) || echo "NO COVERAGE"

Expand Down
290 changes: 218 additions & 72 deletions README.md

Large diffs are not rendered by default.

39 changes: 34 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
'use strict';

var _ = require('lodash');
var express = require('express');
var compression = require('compression');
var bodyParser = require('body-parser');
function create (env, ctx) {
///////////////////////////////////////////////////
// api and json object variables
///////////////////////////////////////////////////
var api = require('./lib/api/')(env, ctx);

function create (env, ctx) {
var app = express();
var appInfo = env.name + ' ' + env.version;
app.set('title', appInfo);
app.enable('trust proxy'); // Allows req.secure test on heroku https connections.

if (ctx.bootErrors && ctx.bootErrors.length > 0) {
app.get('*', require('./lib/booterror')(ctx));
return app;
}

if (env.settings.isEnabled('cors')) {
var allowOrigin = _.get(env, 'extendedSettings.cors.allowOrigin') || '*';
console.info('Enabled CORS, allow-origin:', allowOrigin);
app.use(function allowCrossDomain (req, res, next) {
res.header('Access-Control-Allow-Origin', allowOrigin);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');

// intercept OPTIONS method
if ('OPTIONS' === req.method) {
res.send(200);
} else {
next();
}
});
}

///////////////////////////////////////////////////
// api and json object variables
///////////////////////////////////////////////////
var api = require('./lib/api/')(env, ctx);
var ddata = require('./lib/data/endpoints')(env, ctx);

app.use(compression({filter: function shouldCompress(req, res) {
//TODO: return false here if we find a condition where we don't want to compress
// fallback to standard filter function
Expand All @@ -25,6 +51,9 @@ function create (env, ctx) {
//}
app.use('/api/v1', bodyParser({limit: 1048576 * 50 }), api);

app.use('/api/v2/properties', ctx.properties);
app.use('/api/v2/authorization', ctx.authorization.endpoints);
app.use('/api/v2/ddata', ddata);

// pebble data
app.get('/pebble', ctx.pebble);
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"required": false
},
"THEME": {
"description": "Possible values default or colors",
"description": "Possible values default, colors or colorblindfriendly",
"value": "",
"required": false
},
Expand Down
Loading

0 comments on commit 5f9994d

Please sign in to comment.