From 0aa01d80b0b403db467e5f6f5bf0841533d787f0 Mon Sep 17 00:00:00 2001 From: mallowlabs Date: Tue, 19 Aug 2014 00:33:51 +0900 Subject: [PATCH] Added: heroku-deploy button --- README.markdown | 2 ++ app.json | 25 +++++++++++++++++++++++++ config/message_pusher.yml | 6 +++--- config/mongoid.yml | 3 +++ lib/asakusa_satellite/message_pusher.rb | 10 ++++++---- 5 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 app.json diff --git a/README.markdown b/README.markdown index 99209830a..17ceba13a 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,8 @@ AsakusaSatellite =================== +[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) + [![Build Status](https://secure.travis-ci.org/codefirst/AsakusaSatellite.png?branch=master)](http://travis-ci.org/codefirst/AsakusaSatellite) [![Code Climate](https://codeclimate.com/github/codefirst/AsakusaSatellite.png)](https://codeclimate.com/github/codefirst/AsakusaSatellite) [![Coverage Status](https://coveralls.io/repos/codefirst/AsakusaSatellite/badge.png?branch=master)](https://coveralls.io/r/codefirst/AsakusaSatellite) [![wercker status](https://app.wercker.com/status/b901326474567a915d89a93aed4b1ad5/s/ "wercker status")](https://app.wercker.com/project/bykey/b901326474567a915d89a93aed4b1ad5) Overview diff --git a/app.json b/app.json new file mode 100644 index 000000000..aa69e794c --- /dev/null +++ b/app.json @@ -0,0 +1,25 @@ +{ + "name": "asakusa-satellite", + "description": "A realtime chat application for developers", + "repository": "https://github.com/codefirst/AsakusaSatellite/", + "logo": "https://raw.githubusercontent.com/codefirst/AsakusaSatellite/master/app/assets/images/logo.png", + "env": { + "FILTER_NAME": { + "description": "Filter file name", + "value": "filter" + }, + "MESSAGE_PUSHER_ENGINE": { + "description": "Message pusher type", + "value": "pusher" + }, + "QUOTEIT_URL": { + "description": "QuoteIt URL", + "value": "https://quoteit.herokuapp.com" + } + }, + "addons": [ + "pusher", + "mongohq" + ] +} + diff --git a/config/message_pusher.yml b/config/message_pusher.yml index c405c1425..8b1f3060e 100644 --- a/config/message_pusher.yml +++ b/config/message_pusher.yml @@ -2,9 +2,9 @@ default: <%= ENV['MESSAGE_PUSHER_ENGINE'] || 'socky' %> engines: pusher: - app_id: <%= ENV['MESSAGE_PUSHER_PUSHER_APP_ID'] || 'your_app_id' %> - key: <%= ENV['MESSAGE_PUSHER_PUSHER_KEY'] || 'your_key' %> - secret: <%= ENV['MESSAGE_PUSHER_PUSHER_SECRET'] || 'your_secret' %> + app_id: <%= ENV['MESSAGE_PUSHER_PUSHER_APP_ID'] %> + key: <%= ENV['MESSAGE_PUSHER_PUSHER_KEY'] %> + secret: <%= ENV['MESSAGE_PUSHER_PUSHER_SECRET'] %> keima: url: <%= ENV['MESSAGE_PUSHER_KEIMA_URL'] || 'http://localhost:3001' %> key: <%= ENV['MESSAGE_PUSHER_KEIMA_KEY'] || '4e7c45a1a2cb660517000001' %> diff --git a/config/mongoid.yml b/config/mongoid.yml index 4fce77cb0..ccd80db80 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -7,6 +7,9 @@ test: database: asakusa_satellite_test production: + # if uri is available, uri has priority + uri: <%= ENV['MONGODB_URI'] || ENV['MONGOHQ_URL'] || ENV['MONGOLAB_URI'] %> + # if uri is not available, use below configuration host: <%= ENV['MONGODB_HOST'] || 'localhost' %> port: <%= ENV['MONGODB_PORT'] || 27017 %> database: <%= ENV['MONGODB_DATABASE'] || 'asakusa_satellite_production' %> diff --git a/lib/asakusa_satellite/message_pusher.rb b/lib/asakusa_satellite/message_pusher.rb index a450e17a9..1e3cc75e2 100644 --- a/lib/asakusa_satellite/message_pusher.rb +++ b/lib/asakusa_satellite/message_pusher.rb @@ -37,9 +37,11 @@ class Pusher < Engine secrets :secret def initialize(opt) super(opt) - ::Pusher.app_id = opt['app_id'] - ::Pusher.key = opt['key'] - ::Pusher.secret = opt['secret'] + unless ENV['PUSHER_URL'] + ::Pusher.app_id = opt['app_id'] + ::Pusher.key = opt['key'] + ::Pusher.secret = opt['secret'] + end end def trigger(channel, event, data) @@ -51,7 +53,7 @@ def jsFiles end def jsClass - key = @opt['key'] + key = @opt['key'] || URI.parse(ENV['PUSHER_URL']).user "new Pusher('#{key}')" end end