Skip to content

Commit

Permalink
Merge pull request #209 from cofacts/dev
Browse files Browse the repository at this point in the history
20200710 Release
  • Loading branch information
MrOrz authored Jul 9, 2020
2 parents 64889b5 + 4b3dd66 commit 0506017
Show file tree
Hide file tree
Showing 50 changed files with 4,642 additions and 798 deletions.
24 changes: 22 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# From LINE developer console
# From LINE Messaging developer console
LINE_CHANNEL_SECRET=
LINE_CHANNEL_TOKEN=

# From LINE LOGIN developer console, use for external browser liff login
LINE_LOGIN_CHANNEL_ID=

# Redis stores chatbot's conversation context among HTTP requests
REDIS_URL=redis://localhost:6379

Expand All @@ -19,6 +22,7 @@ ROLLBAR_CLIENT_TOKEN=

# This should match rumors-api's RUMORS_LINE_BOT_SECRET
APP_SECRET=CHANGE_ME
APP_ID=RUMORS_LINE_BOT

# Cofacst API URL
API_URL=https://cofacts-api.hacktabl.org/graphql
Expand Down Expand Up @@ -52,5 +56,21 @@ LIFF_DEV_PORT=8080
# Secret to sign and validate JWT
JWT_SECRET=secret

# Language setup for chatbot UI
LOCALE=en_US

# MONGODB
MONGODB_URI=mongodb://root:root-test-password@localhost:27017
MONGODB_URI=mongodb://root:root-test-password@localhost:27017/cofacts?authSource=admin

# Uncomment this to bypass in-client check in LIFF, enable debugging on extenral browsers
# DEBUG_LIFF=1

# LINE_NOTIFY or PUSH_MESSAGE
NOTIFY_METHOD=PUSH_MESSAGE

# From LINE nofify service management page
LINE_NOTIFY_CLIENT_ID=
LINE_NOTIFY_CLIENT_SECRET=

# Should be a public url, it's used for line nofity auth callback and redirect
RUMORS_LINE_BOT_URL=
25 changes: 13 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ module.exports = {
'plugin:import/warnings',
'prettier',
],
env: {node: true, es6: true, jest: true},
plugins: [
'prettier',
],
env: { node: true, es6: true, jest: true },
plugins: ['prettier'],
rules: {
'prettier/prettier': ['error', {
trailingComma: 'es5',
'singleQuote': true,
}],
'prettier/prettier': [
'error',
{
trailingComma: 'es5',
singleQuote: true,
},
],
'no-console': 'off', // just use console :P
},
settings: {
'import/resolver': {
'babel-module': {}
}
}
}
'babel-module': {},
},
},
};
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ script:
- npm run i18n:validate
- npm run test -- --coverage

env:
- MONGODB_URI=mongodb://root:root-test-password@localhost:27017

after_success:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Other customizable env vars are:
* `GOOGLE_CREDENTIALS`: will be populated by `authGoogleDrive.js`. See "Upload image/video" section below.
* `GA_ID`: Google analytics universal analytics tracking ID, for tracking events
* `IMAGE_MESSAGE_ENABLED`: Default disabled. To enable, please see "Process image message" section below.
* `DEBUG_LIFF`: Disables external browser check in LIFF. Useful when debugging LIFF in external browser. Don't enable this on production.

### Redis server

Expand Down Expand Up @@ -172,6 +173,27 @@ On Heroku, please set `LOCALE` to one of `en_US`, `zh_TW` or any other language

If you want to build using docker instead, you may need to modify Dockerfile to include the desired `LOCALE`.

#### Notification setup
- Prerequisites :
1. [LIFF setup](https://github.com/cofacts/rumors-line-bot#liff-setup)
2. Connect MongoDB

- To use [push message](https://developers.line.biz/en/reference/messaging-api/#send-push-message) :
in `.env` file, sets `NOTIFY_METHOD=PUSH_MESSAGE`

- To use [LINE notify](https://notify-bot.line.me/en/) :
1. You should first [register a service](https://notify-bot.line.me/my/services/).
2. Then sets up `Callback Url` : `RUMORS_LINE_BOT_URL`/authcallback/line_notify
3. in `.env` file, sets
```
LINE_NOTIFY_CLIENT_ID=<paste LINE Notify Client ID here>
LINE_NOTIFY_CLIENT_SECRET=<paste LINE Notify Client Secret here>
NOTIFY_METHOD=LINE_NOTIFY
RUMORS_LINE_BOT_URL=<line bot server url>
```
You can set up a setting page entry point(`LIFF_URL`/liff/index.html?p=setting) in [account manager](https://manager.line.biz/account/) -> rich menu
---
## Production Deployment
Expand Down
Loading

0 comments on commit 0506017

Please sign in to comment.