Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

add base callback url to config #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const nconf = require('nconf')
const express = require('express')
const bodyParser = require('body-parser')
const session = require('express-session')
Expand All @@ -11,6 +12,9 @@ const socket = require('./helpers/socket')

const app = express()

// load config
nconf.file({ file: 'config.json' }).env()

app.set('port', (process.env.PORT || 5000))
app.set('views', __dirname + '/views')
app.set('view engine', 'ejs')
Expand Down Expand Up @@ -64,7 +68,7 @@ app.get('/webhook/twitter', function(request, response) {
app.post('/webhook/twitter', function(request, response) {

console.log(request.body)

socket.io.emit(socket.activity_event, {
internal_id: uuid(),
event: request.body
Expand Down Expand Up @@ -92,14 +96,14 @@ app.get('/subscriptions', auth.basic, cacheRoute(1000), require('./routes/subscr
* Starts Twitter sign-in process for adding a user subscription
**/
app.get('/subscriptions/add', passport.authenticate('twitter', {
callbackURL: '/callbacks/addsub'
callbackURL: `${nconf.get('BASE_CALLBACK_URL')}/callbacks/addsub`
}));

/**
* Starts Twitter sign-in process for removing a user subscription
**/
app.get('/subscriptions/remove', passport.authenticate('twitter', {
callbackURL: '/callbacks/removesub'
callbackURL: `${nconf.get('BASE_CALLBACK_URL')}/callbacks/removesub`
}));


Expand Down
5 changes: 3 additions & 2 deletions config.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"TWITTER_ACCESS_TOKEN_SECRET": "your-access-token-secret",
"TWITTER_WEBHOOK_ENV": "env-beta",
"BASIC_AUTH_USER": "admin",
"BASIC_AUTH_PASSWORD": "bluebird"
}
"BASIC_AUTH_PASSWORD": "bluebird",
"BASE_CALLBACK_URL": "https://your.app.domain"
}