Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pulled config changes into app_config.rb

  • Loading branch information...
commit b9acda1899d8ff78daf8f17beaf140c3b23775dc 1 parent 1684fe0
@oppegard authored
Showing with 11 additions and 15 deletions.
  1. +2 −13 app.rb
  2. +9 −2 app_config.rb
View
15 app.rb
@@ -29,26 +29,15 @@
require 'hiredis'
require 'redis'
require 'page'
+require 'json'
require 'app_config'
require 'sinatra'
-require 'json'
require 'digest/sha1'
require 'digest/md5'
require 'comments'
-$vcap_services = JSON.parse(ENV['VCAP_SERVICES']) if ENV['VCAP_SERVICES']
-
before do
- redis_conf = {}
- if $vcap_services
- redis = $vcap_services['redis-2.2'][0]
- redis_conf = {:host => redis['credentials']['hostname'],
- :port => redis['credentials']['port'],
- :password => redis['credentials']['password']}
- else
- redis_conf = {:host => RedisHost, :port => RedisPort}
- end
- $r = Redis.new(redis_conf) if !$r
+ $r = Redis.new(RedisConfig) if !$r
H = HTMLGen.new if !defined?(H)
if !defined?(Comments)
Comments = RedisComments.new($r,"comment",proc{|c,level|
View
11 app_config.rb
@@ -2,8 +2,15 @@
SiteName = "Lamer News"
# Redis config
-RedisHost = "127.0.0.1"
-RedisPort = 10000
+RedisConfig = {:host => "127.0.0.1", :port => 10000}
+## Check for Cloud Foundry
+vcap_services = JSON.parse(ENV['VCAP_SERVICES']) if ENV['VCAP_SERVICES']
+if vcap_services
+ redis = vcap_services['redis-2.2'][0]
+ RedisConfig = {:host => redis['credentials']['hostname'],
+ :port => redis['credentials']['port'],
+ :password => redis['credentials']['password']}
+end
# Security
PasswordSalt = "*LAMER*news*"
Please sign in to comment.
Something went wrong with that request. Please try again.