Skip to content
This repository was archived by the owner on Sep 18, 2021. It is now read-only.
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
103 changes: 0 additions & 103 deletions app/config/application.js

This file was deleted.

4 changes: 0 additions & 4 deletions app/config/environments/development.js

This file was deleted.

4 changes: 0 additions & 4 deletions app/config/environments/production.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/controllers/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module.exports = require('matador').BaseController.extend(function () {
this.viewFolder = ''
this.layout = 'layout'
this.config = app.getConfig()
this.config = app.config
})
.methods({

Expand Down
14 changes: 7 additions & 7 deletions app/controllers/HomeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ module.exports = require('./ApplicationController').extend(function () {
index: function () {
this.render('index', {
view: 'index'
, event: this.config.event
, participants: this.config.participants
, screen_name: this.config.twitter_account.screen_name
, site: this.config.site
, event: this.config.get('event')
, participants: this.config.get('participants')
, screen_name: this.config.get('twitter_account:screen_name')
, site: this.config.get('site')
, css: [
{url: 'lib/bootstrap/bootstrap-responsive.css'}
, {url: 'css/application-responsive.css'}
Expand All @@ -44,9 +44,9 @@ module.exports = require('./ApplicationController').extend(function () {
, display: function () {
this.render('display', {
view: 'presentation'
, event: this.config.event
, screen_name: this.config.twitter_account.screen_name
, site: this.config.site
, event: this.config.get('event')
, screen_name: this.config.get('twitter_account:screen_name')
, site: this.config.get('site')
});
}

Expand Down
4 changes: 2 additions & 2 deletions app/models/ApplicationModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ module.exports = Class(function () {
this.mongo = require('mongodb')
this.mongoose = require('mongoose')
this.Schema = this.mongoose.Schema
this.config = app.getConfig()
this.mongoose.connect(this.config.database)
this.config = app.config
this.mongoose.connect(this.config.get('database'))
})
2 changes: 1 addition & 1 deletion app/services/BaseService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = Class(function(){
this.config = app.getConfig()
this.config = app.config
})
.methods ({
getModel: function (name) {
Expand Down
21 changes: 11 additions & 10 deletions app/services/StreamService.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,31 @@ var io = require('socket.io').listen(app)
io.set('log level', 1)

module.exports = require(app.set('services') + '/BaseService').extend(function () {

this.twttr = new twitter({
consumer_key: this.config.twitter_app.consumer_key
, consumer_secret: this.config.twitter_app.consumer_secret
, access_token_key: this.config.twitter_app.access_token_key
, access_token_secret: this.config.twitter_app.access_token_secret
consumer_key: this.config.get('twitter_app:consumer_key')
, consumer_secret: this.config.get('twitter_app:consumer_secret')
, access_token_key: this.config.get('twitter_app:access_token_key')
, access_token_secret: this.config.get('twitter_app:access_token_secret')
})

this.stream_active = false
this.account_details = {
id_str: this.config.twitter_account.id
, screen_name: this.config.twitter_account.screen_name
id_str: this.config.get('twitter_account:id')
, screen_name: this.config.get('twitter_account:screen_name')
}

this.moderators = [
{
id_str: this.config.twitter_account.id
, screen_name: this.config.twitter_account.screen_name
id_str: this.config.get('twitter_account:id')
, screen_name: this.config.get('twitter_account:screen_name')
}
]
v.each(this.config.moderators, function(moderator) {
v.each(this.config.get('moderators'), function(moderator) {
this.moderators.push(moderator)
}.bind(this))

this.blacklist = this.config.blacklist
this.blacklist = this.config.get('blacklist')

this.account_statuses = []
this.model = this.getModel('Favorites')
Expand Down
84 changes: 84 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{

"database": "mongo://"
, "server_port": "80"

, "twitter_app": {
"consumer_key": "",
"consumer_secret": "",
"access_token_key": "",
"access_token_secret": ""
}

, "twitter_account": {
"id": "495336570"
, "screen_name": "dftg"
}

, "moderators": [
{
"id_str": "18644328"
, "screen_name": "philcoffman"
}
]

, "blacklist": [
{
"id_str": ""
, "screen_name": ""
}
]

, "site": {
"raw_url": "http://designfromthegut.com"
, "display_url": "designfromthegut.com"
, "google_analytics": "UA-8533626-2"
}

, "event": {
"title": "Design from the Gut"
, "description": "Debating whether research or intuition is a better approach to design should be a communal discussion."
, "instructions": "<strong>Submit a question or comment by posting a tweet to <a href='https://twitter.com/intent/user?screen_name=dftg' title='Design from the Gut on Twitter'>@dftg</a> via the button below. Review the submissions and favorite the ones you\"d like to see answered</strong>. The moderator will choose from the top picks."
, "time": "Friday, 3/9, 3:30p"
, "location": "Ballroom BC &bull; ACC"
, "details_url": "http://schedule.sxsw.com/2012/events/event_IAP11592"
}

, "participants": [
{
"name": "Phil Coffman"
, "title": "Principal, Element"
, "twitter": "philcoffman"
, "img_url": "coffman.gif"
, "role": "Moderator"
}
, {
"name": "Bill Couch"
, "title": "Software engineer, Twitter"
, "twitter": "couch"
, "img_url": "couch.gif"
, "role": "Panelist"
}
, {
"name": "Naz Hasdamid"
, "title": "Principal, Weightshift"
, "twitter": "weightshift"
, "img_url": "hamid.gif"
, "role": "Panelist"
}
, {
"name": "Laurel Hechanova"
, "title": "Designer, Illustrator, Apocalypse OK"
, "twitter": "hechanova"
, "img_url": "hechanova.gif"
, "role": "Panelist"
}
, {
"name": "Jane Leibrock"
, "title": "User Experience Researcher, Facebook"
, "twitter": "fencebreak"
, "img_url": "leibrock.gif"
, "role": "Panelist"
}
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"klass": "*",
"colors": "*",
"hogan.js": "*",
"matador": "<=0.0.14"
"matador": "<=0.0.14",
"nconf": "0.5.1"
},
"domains": [
"designfromthegut.com"
Expand Down
36 changes: 13 additions & 23 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

var matador = require('matador')
var fs = require('fs')
var nconf = require('nconf')

app.configure(function () {
app.set('models', __dirname + '/app/models')
Expand All @@ -23,29 +24,18 @@ app.configure(function () {
app.set('controllers', __dirname + '/app/controllers')
app.set('services', __dirname + '/app/services')

// added code

app.set('config', __dirname + '/app/config')
var configStore = {}
function fetchConfig() {
configStore = require(app.set('config') + '/application')
var env = process.env.NODE_ENV
if (!env) env = 'production' // default to production
var env_config_file = app.set('config') + '/environments/' + env + '.js'
try {
var stat = fs.statSync(env_config_file)
if (!stat.isFile()) return
v.extend(configStore, require(env_config_file))
} catch (e) {
return
}
}
fetchConfig()

app.getConfig = function () {
return configStore
}
//
// Setup nconf to use (in-order):
// 1. Command-line arguments
// 2. Environment variables
// 3. A file located at 'path/to/config.json'
//
nconf.argv()
.env()
.file({ file: 'config.json' });

app.config = nconf;
var serviceList = ['Stream']
var serviceStore = []

Expand Down Expand Up @@ -101,5 +91,5 @@ app.configure('production', function () {
})
matador.mount(require('./app/config/routes'))

app.listen(app.getConfig().server_port)
console.log('matador running on port ' + app.getConfig().server_port)
app.listen(app.config.get('server_port'))
console.log('matador running on port ' + app.config.get('server_port'))