-
Notifications
You must be signed in to change notification settings - Fork 71.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
2,955 additions
and
1,029 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
language: node_js | ||
sudo: false | ||
node_js: | ||
- "0.10" | ||
- "0.11" | ||
matrix: | ||
allow_failures: | ||
- node_js: "0.11" | ||
services: | ||
- mongodb | ||
before_script: | ||
- sleep 10 | ||
- echo mongo mongo_travis | ||
script: | ||
- make travis | ||
- "0.10" | ||
- "0.12" | ||
services: mongodb | ||
script: make travis | ||
after_script: make report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
web: node server.js | ||
web: ./node_modules/.bin/forever --minUptime 100 -c node server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,7 +92,7 @@ Use the [autoconfigure tool][autoconfigure] to sync an uploader to your config. | |
|
||
#### Features/Labs | ||
|
||
* `ENABLE` - Used to enable optional features, expects a space delimited list such as: `careportal rawbg` (also `rawbg-on` to show raw data by default) | ||
* `ENABLE` - Used to enable optional features, expects a space delimited list such as: `careportal rawbg iob` | ||
* `API_SECRET` - A secret passphrase that must be at least 12 characters long, required to enable `POST` and `PUT`; also required for the Care Portal | ||
* `BG_HIGH` (`260`) - must be set using mg/dl units; the high BG outside the target range that is considered urgent | ||
* `BG_TARGET_TOP` (`180`) - must be set using mg/dl units; the top of the target range, also used to draw the line on the chart | ||
|
@@ -114,11 +114,29 @@ Use the [autoconfigure tool][autoconfigure] to sync an uploader to your config. | |
* `SSL_CERT` - Path to your ssl cert file, so that ssl(https) can be enabled directly in node.js | ||
* `SSL_CA` - Path to your ssl ca file, so that ssl(https) can be enabled directly in node.js | ||
|
||
|
||
#### Predefined values for your browser settings (optional) | ||
* `TIME_FORMAT` (`12`)- possible values `12` or `24` | ||
* `NIGHT_MODE` (`off`) - possible values `on` or `off` | ||
* `SHOW_RAWBG` (`never`) - possible values `always`, `never` or `noise` | ||
* `CUSTOM_TITLE` (`Nightscout`) - Usually name of T1 | ||
* `THEME` (`default`) - possible values `default` or `colors` | ||
* `ALARM_URGENT_HIGH` (`on`) - possible values `on` or `off` | ||
* `ALARM_HIGH` (`on`) - possible values `on` or `off` | ||
* `ALARM_LOW` (`on`) - possible values `on` or `off` | ||
* `ALARM_URGENT_LOW` (`on`) - possible values `on` or `off` | ||
* `ALARM_TIMEAGO_WARN` (`on`) - possible values `on` or `off` | ||
* `ALARM_TIMEAGO_WARN_MINS` (`15`) - minutes since the last reading to trigger a warning | ||
* `ALARM_TIMEAGO_URGENT` (`on`) - possible values `on` or `off` | ||
* `ALARM_TIMEAGO_URGENT_MINS` (`30`) - minutes since the last reading to trigger a urgent alarm | ||
|
||
|
||
## Setting environment variables | ||
Easy to emulate on the commandline: | ||
|
||
```bash | ||
echo 'MONGO_CONNECTION="mongodb://sally:[email protected]:99999/nightscout"' >> my.env | ||
echo 'MONGO_CONNECTION=mongodb://sally:[email protected]:99999/nightscout' >> my.env | ||
echo 'MONGO_COLLECTION=entries' >> my.env | ||
``` | ||
|
||
From now on you can run using | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
var express = require('express'); | ||
var compression = require('compression'); | ||
function create (env, ctx) { | ||
/////////////////////////////////////////////////// | ||
// api and json object variables | ||
/////////////////////////////////////////////////// | ||
var api = require('./lib/api/')(env, ctx.entries, ctx.settings, ctx.treatments, ctx.profiles, ctx.devicestatus); | ||
var pebble = ctx.pebble; | ||
|
||
var app = express(); | ||
app.entries = ctx.entries; | ||
app.treatments = ctx.treatments; | ||
app.profiles = ctx.profiles; | ||
app.devicestatus = ctx.devicestatus; | ||
var appInfo = env.name + ' ' + env.version; | ||
app.set('title', appInfo); | ||
app.enable('trust proxy'); // Allows req.secure test on heroku https connections. | ||
|
||
app.use(compression({filter: shouldCompress})); | ||
|
||
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 | ||
return compression.filter(req, res); | ||
} | ||
|
||
//if (env.api_secret) { | ||
// console.log("API_SECRET", env.api_secret); | ||
//} | ||
app.use('/api/v1', api); | ||
|
||
|
||
// pebble data | ||
app.get('/pebble', pebble(ctx.entries, ctx.treatments, ctx.profiles, ctx.devicestatus, env)); | ||
|
||
//app.get('/package.json', software); | ||
|
||
// define static server | ||
//TODO: JC - changed cache to 1 hour from 30d ays to bypass cache hell until we have a real solution | ||
var staticFiles = express.static(env.static_files, {maxAge: 60 * 60 * 1000}); | ||
|
||
// serve the static content | ||
app.use(staticFiles); | ||
|
||
var bundle = require('./bundle')(); | ||
app.use(bundle); | ||
|
||
// Handle errors with express's errorhandler, to display more readable error messages. | ||
|
||
// Handle errors with express's errorhandler, to display more readable error messages. | ||
var errorhandler = require('errorhandler'); | ||
//if (process.env.NODE_ENV === 'development') { | ||
app.use(errorhandler()); | ||
//} | ||
return app; | ||
} | ||
module.exports = create; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(function () { | ||
|
||
window.Nightscout = window.Nightscout || {}; | ||
|
||
window.Nightscout = { | ||
iob: require('../lib/iob')() | ||
, units: require('../lib/units')() | ||
}; | ||
|
||
console.info("Nightscout bundle ready", window.Nightscout); | ||
|
||
})(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
var browserify_express = require('browserify-express'); | ||
|
||
function bundle() { | ||
return browserify_express({ | ||
entry: __dirname + '/bundle.source.js', | ||
watch: __dirname + '/../lib/', | ||
mount: '/public/js/bundle.js', | ||
verbose: true, | ||
//minify: true, | ||
bundle_opts: { debug: true }, // enable inline sourcemap on js files | ||
write_file: __dirname + '/bundle.out.js' | ||
}); | ||
} | ||
|
||
module.exports = bundle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.