Skip to content
This repository was archived by the owner on Feb 6, 2019. It is now read-only.

Commit af008a6

Browse files
author
Romit Amgai
authored
Merge pull request #1 from leapfrogtechnology/dev
Add REST API code from the chill-dashboard
2 parents 5693642 + e3022b7 commit af008a6

31 files changed

+4864
-2
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": ["es2015", "es2016", "es2017"],
3+
"plugins": [
4+
"dynamic-import-node"
5+
]
6+
}

.codeclimate.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
engines:
2+
eslint:
3+
enabled: true
4+
duplication:
5+
enabled: true
6+
config:
7+
languages:
8+
- javascript
9+
fixme:
10+
enabled: true
11+
ratings:
12+
paths:
13+
- src/**
14+
exclude_paths:
15+
- dist/*
16+
- test/**/*
17+
- coverage/**/*
18+
- node_modules/**/*

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
env:
2+
es6: true
3+
node: true
4+
mocha: true
5+
6+
parserOptions:
7+
ecmaVersion: 2017
8+
sourceType: module
9+
10+
extends: 'eslint:recommended'
11+
parser: babel-eslint
12+
rules:
13+
no-var: 2
14+
key-spacing: 2
15+
semi-spacing: 2
16+
block-spacing: 2
17+
spaced-comment: 2
18+
callback-return: 2
19+
space-infix-ops: 2
20+
keyword-spacing: 2
21+
newline-after-var: 2
22+
space-before-blocks: 2
23+
handle-callback-err: 2
24+
newline-before-return: 2
25+
semi: [2, 'always']
26+
eqeqeq: [2, 'always']
27+
eol-last: [2, 'always']
28+
max-statements: [2, 30]
29+
comma-dangle: [2, never]
30+
indent: [2, 2, {'SwitchCase': 1}]
31+
object-curly-spacing: [2, 'always']
32+
comma-spacing: [2, {'before': false, 'after': true}]
33+
quotes: [2, 'single', {'allowTemplateLiterals': true}]

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Dependency directories
9+
node_modules
10+
11+
# Optional npm cache directory
12+
.npm
13+
14+
# Optional REPL history
15+
.node_repl_history
16+
17+
# Yarn integrity file
18+
.yarn-integrity
19+
20+
# IntelliJ IDE
21+
.idea
22+
23+
# Build directory
24+
dist
25+
26+
# Dotenv configuration
27+
.env
28+
29+
# Visual Studio Code
30+
.vscode
31+
32+
# Test Coverage
33+
coverage
34+
35+
# Chill database
36+
chill.db
37+
chill.yml

.nodemonignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Build directory
2+
dist
3+
4+
# Test directory
5+
test
6+
7+
# Other directories
8+
src/seeds
9+
src/migrations

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
language: node_js
2+
node_js:
3+
- "8"
4+
- "7"
5+
- "6"
6+
script:
7+
- npm run test:coverage
8+
after_script:
9+
- npm run codecov

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@ $ npm install
1212
# Or using yarn
1313
$ yarn
1414
```
15+
Create a config `chill.yml` file using the sample file.
16+
```bash
17+
$ cp chill.yml.dist chill.yml
18+
```
19+
20+
Run migrations
21+
```
22+
$ yarn migrate
23+
```
1524

16-
Then start the app
25+
Then start the server by providing the config file path. If this is not provided, it will expect the file to be in the current directory.
1726
```
18-
$ npm start
27+
$ CHILL_CONFIG=/path/to/chill.yml yarn start
1928
```
2029

2130
## Contributing

chill.yml.dist

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
logging:
2+
level: debug
3+
4+
db:
5+
client: 'sqlite3'
6+
connection:
7+
filename: './chill.db'
8+
9+
restApi:
10+
port: 8000
11+
12+
monitoring:
13+
minInterval: 1000
14+
maxInterval: 10000
15+
method: OPTIONS
16+
downStatus: '^(5..|4..)$'
17+
18+
notifications:
19+
slack:
20+
enabled: false
21+
endpoint: SLACK_WEBHOOK_ENDPOINT
22+
hipchat:
23+
enabled: false
24+
authToken: HIPCHAT_WEBHOOK_TOKENID
25+
roomId: HIPTCHAT_WEBHOOK_ROOMID
26+
twilio:
27+
enabled: false
28+
sender: SENDING_NUMBER
29+
receiver: RECEIVING_NUMBER
30+
authToken: AUTH_TOKEN
31+
accountSid: ACCOUNT_SID
32+
email:
33+
enabled: false
34+
transport:
35+
service: EMAIL_SERVICE # Check https://nodemailer.com/smtp/well-known/ for all email services
36+
auth:
37+
user: EMAIL_ACCOUNT_USERNAME
38+
pass: EMAIL_ACCOUNT_PASSWORD
39+
sender: SENDER_NAME_EMAIL
40+
receivers:
41+
- RECEIVER_EMAIL
42+
templateDir: TEMPLATE_DIRECTORY
43+
44+
services:
45+
- name: 'Localhost'
46+
url: 'http://127.0.0.1'

knexfile.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require('babel-register');
2+
3+
const config = require('./src/config/config');
4+
const dbConfig = config.resolve().db;
5+
6+
module.exports = Object.assign({}, dbConfig, {
7+
migrations: {
8+
directory: './src/migrations'
9+
}
10+
});
11+

0 commit comments

Comments
 (0)