Skip to content

Commit 589d9ad

Browse files
authored
Merge pull request #4 from EnsembleLab/dev
Dev
2 parents a9505ce + 2453586 commit 589d9ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2657
-475
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
- mongodb
55
- redis-server
66
env:
7-
- MONGOLAB_URL=mongodb://127.0.0.1/snipe RATE_LIMIT=10 REDIS_URL=redis://127.0.0.1/1 SECURE_MODE=true
7+
- MONGOLAB_URL=mongodb://127.0.0.1/snipe RATE_LIMIT=10 REDIS_URL=redis://127.0.0.1/1 SECURE_MODE=true NO_CACHE=no
88
addons:
99
apt:
1010
sources:

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<a name="0.2.0"></a>
2+
# [0.2.0](https://github.com/EnsembleLab/api-template/compare/0.1.1...v0.2.0) (2017-09-04)
3+
4+
5+
### Bug Fixes
6+
7+
* **User model:** Now creates search tags properly ([88f8267](https://github.com/EnsembleLab/api-template/commit/88f8267))
8+
9+
10+
### Features
11+
12+
* **User Router:** Completed tests for user router ([71ee3bb](https://github.com/EnsembleLab/api-template/commit/71ee3bb))
13+
14+
15+
16+
<a name="0.1.1"></a>
17+
## [0.1.1](https://github.com/EnsembleLab/api-template/compare/0.1.0...v0.1.1) (2017-08-26)
18+
19+
20+
21+
<a name="0.1.0"></a>
22+
# [0.1.0](https://github.com/EnsembleLab/api-template/compare/0.0.2...v0.1.0) (2017-08-17)
23+
24+
25+

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,4 @@
77
API Development Template
88

99

10-
## ToDo
1110

12-
- Implement Helmet for security
13-
- Implement Express Limiter for limiting requests

TODO.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### TODOs
2+
| Filename | line # | TODO
3+
|:------|:------:|:------
4+
| routes/index.js | 240 | Implement API Generator
5+
| services/queue/clock.js | 11 | work on a clock functionality so kue can support scheduled jobs

app.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22
var cluster = require('cluster');
33
var config = require('./config');
44
var log = require('./services/logger');
5+
var basicAuth = require('basic-auth-connect');
6+
var express = require('express');
57

68
if (cluster.isMaster && config.env === 'production') {
9+
var kue = require('./services/queue').kue;
10+
var app = express();
11+
app.use(basicAuth(config.queueUIUsername, config.queueUIPassword));
12+
app.use(kue.app);
13+
var server = app.listen(config.queueUIPort, function () {
14+
var host = server.address().address;
15+
var port = server.address().port;
16+
log.info('Queue UI listening on host '+host+', port '+port+'!');
17+
});
718
// Count the machine's CPUs
819
var cpuCount = require('os').cpus().length;
920

@@ -21,10 +32,10 @@ if (cluster.isMaster && config.env === 'production') {
2132
});
2233

2334
} else {
24-
var express = require('express');
2535
var app = express();
2636
var router = require('./routes');
2737
var express_enforces_ssl = require('express-enforces-ssl');
38+
var workers = require('./services/queue/workers');
2839

2940
if(config.trustProxy === 'yes'){
3041
app.enable('trust proxy');
@@ -44,7 +55,7 @@ if(config.env === 'production'){
4455
var server = app.listen(config.port, function () {
4556
var host = server.address().address;
4657
var port = server.address().port;
47-
log.info('listening on host '+host+', port '+port+'!');
58+
log.info('API server listening on host '+host+', port '+port+'!');
4859
});
4960

5061
}

config/development.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ module.exports = {
88
secret: process.env.SECRET || 'lakikihdgdfdjjjdgd67264664vdjhjdyncmxuei8336%%^#%gdvdhj????jjhdghduue',
99
mongoURL: process.env.MONGOLAB_URL || 'mongodb://192.168.99.100/snipe',
1010
noFrontendCaching: process.env.NO_CACHE || 'yes',
11+
frontendCacheExpiry: process.env.FRONTEND_CACHE_EXPIRY || '90',
12+
backendCacheExpiry: process.env.BACKEND_CACHE_EXPIRY || '90',
1113
rateLimit: process.env.RATE_LIMIT || '1800',
1214
rateLimitExpiry: process.env.RATE_LIMIT_EXPIRY || '3600000',
1315
redisURL: process.env.REDIS_URL || 'redis://192.168.99.100:6379/1',
1416
letsencryptSSLVerificationURL: process.env.LETSENCRYPT_VERIFICATION_URL || '/.well-known/acme-challenge/xvArhQBSilF4V30dGUagNAZ96ASipB0b0ex0kXn0za8',
1517
letsencryptSSLVerificationBody: process.env.LETSENCRYPT_VERIFICATION_BODY || 'xvArhQBSilF4V30dGUagNAZ96ASipB0b0ex0kXn0za8._v6aFbaRYWeOmSebtlD-X4Ixf5tPsyULMsXM8HjsK-Q',
1618
maxContentLength: process.env.MAX_CONTENT_LENGTH || '9999',
17-
enforceSSL: process.env.ENFORCE_SSL || 'no'
19+
enforceSSL: process.env.ENFORCE_SSL || 'no',
20+
gitOAuthToken: process.env.GIT_OAUTH_TOKEN || '6870f32edf6a34aaca7f193f456fae50f8ad5a94',
21+
queueUIUsername: process.env.QUEUE_UI_USERNAME || 'admin',
22+
queueUIPassword: process.env.QUEUE_UI_PASSWORD || 'password123/',
23+
queueUIPort: process.env.QUEUE_UI_PORT || 3000,
24+
enforceUserIdAppIdDeveloperId: process.env.ENFORCE_USER_ID_APP_ID_DEVELOPER_ID || 'yes'
1825
};

config/production.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ module.exports = {
88
secret: process.env.SECRET || 'lakikihdgdfdjjjdgd67264660okjnbgtrdxswerfgytg373745ei8336%%^#%gdvdhj????jjhdghduue',
99
mongoURL: process.env.MONGOLAB_URL || 'mongodb://192.168.99.100/snipe',
1010
noFrontendCaching: process.env.NO_CACHE || 'no',
11+
frontendCacheExpiry: process.env.FRONTEND_CACHE_EXPIRY || '90',
12+
backendCacheExpiry: process.env.BACKEND_CACHE_EXPIRY || '90',
1113
rateLimit: process.env.RATE_LIMIT || '1800',
1214
rateLimitExpiry: process.env.RATE_LIMIT_EXPIRY || '3600000',
1315
redisURL: process.env.REDIS_URL || 'redis://192.168.99.100:6379/1',
1416
letsencryptSSLVerificationURL: process.env.LETSENCRYPT_VERIFICATION_URL || '/.well-known/acme-challenge/xvArhQBSilF4V30dGUagNAZ96ASipB0b0ex0kXn0za8',
1517
letsencryptSSLVerificationBody: process.env.LETSENCRYPT_VERIFICATION_BODY || 'xvArhQBSilF4V30dGUagNAZ96ASipB0b0ex0kXn0za8._v6aFbaRYWeOmSebtlD-X4Ixf5tPsyULMsXM8HjsK-Q',
1618
maxContentLength: process.env.MAX_CONTENT_LENGTH || '9999',
17-
enforceSSL: process.env.ENFORCE_SSL || 'no'
19+
enforceSSL: process.env.ENFORCE_SSL || 'no',
20+
gitOAuthToken: process.env.GIT_OAUTH_TOKEN || '6870f32edf6a34aaca7f193f456fae50f8ad5a94',
21+
queueUIUsername: process.env.QUEUE_UI_USERNAME || 'admin',
22+
queueUIPassword: process.env.QUEUE_UI_PASSWORD || 'password123/',
23+
queueUIPort: process.env.QUEUE_UI_PORT || 3000,
24+
enforceUserIdAppIdDeveloperId: process.env.ENFORCE_USER_ID_APP_ID_DEVELOPER_ID || 'yes'
1825
};

0 commit comments

Comments
 (0)