aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorre4k <re4k@re4k.info>2013-03-23 19:22:25 +0900
committerre4k <re4k@re4k.info>2013-03-23 19:22:25 +0900
commit80eca202c9ae3b3a6098c1654a530b1cd46326cf (patch)
treefca38131a5cd9acefa24cd50fc00870099d2d787 /config
parent773d8610cda565a0bd395f16d94bbda912273237 (diff)
downloadaclog-80eca202c9ae3b3a6098c1654a530b1cd46326cf.tar.gz
refactor
Diffstat (limited to 'config')
-rw-r--r--config/application.rb2
-rw-r--r--config/environments/development.rb4
-rw-r--r--config/environments/production.rb2
-rw-r--r--config/initializers/omniauth.rb15
-rw-r--r--config/routes.rb37
-rw-r--r--config/settings.yml6
6 files changed, 48 insertions, 18 deletions
diff --git a/config/application.rb b/config/application.rb
index 7df2cca..ab8b888 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -21,5 +21,7 @@ module Aclog
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
+
+ config.exceptions_app = self.routes
end
end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 5f95ca6..5089ff4 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -10,7 +10,7 @@ Aclog::Application.configure do
config.eager_load = false
# Show full error reports and disable caching.
- config.consider_all_requests_local = true
+ config.consider_all_requests_local = false#true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
@@ -24,4 +24,6 @@ Aclog::Application.configure do
# Expands the lines which load the assets.
config.assets.debug = true
+
+ # config.cache_store = :dalli_store
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index c219686..fc529ba 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -52,7 +52,7 @@ Aclog::Application.configure do
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
- # config.cache_store = :mem_cache_store
+ config.cache_store = :dalli_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index 540652c..eaee9f6 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -1,7 +1,18 @@
+OmniAuth.config.full_host = -> env do
+ scheme = env["rack.url_scheme"]
+ forwarded_host = env["HTTP_X_FORWARDED_HOST"]
+
+ host = forwarded_host.blank? ?
+ env["HTTP_HOST"] :
+ forwarded_host
+
+ "#{scheme}://#{host}"
+end
+
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter,
- Settings.consumer_key,
- Settings.consumer_secret,
+ Settings.consumer[Settings.consumer_version].key,
+ Settings.consumer[Settings.consumer_version].secret,
:request_path => "/i/login",
:callback_path => "/i/callback"
end
diff --git a/config/routes.rb b/config/routes.rb
index a7b879f..66a28c7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,18 +4,31 @@ Aclog::Application.routes.draw do
:screen_name => /[a-zA-Z0-9_]{1,20}/,
:page => /[0-9]+/,
}
+ get "/404" => "errors#error_404"
+ get "/500" => "errors#error_500"
root :to => "main#index"
- get "i/callback" => "sessions#callback"
- get "i/logout" => "sessions#destroy"
-
- get "i/:id" => "i#show", :constraints => constraints
- get ":screen_name/status(es)/:id" => "i#show", :constraints => constraints
-
- get ":screen_name(/:page)" => "users#best", :constraints => constraints
- get ":screen_name/my(/:page)" => "users#my", :constraints => constraints
- get ":screen_name/discovered(/:page)" => "users#my", :constraints => constraints
- get ":screen_name/timeline(/:page)" => "users#timeline", :constraints => constraints
- get ":screen_name/recent(/:page)" => "users#recent", :constraints => constraints
- get ":screen_name/info(/:page)" => "users#info", :constraints => constraints
+
+ get "/i/callback" => "sessions#callback"
+ get "/i/logout" => "sessions#destroy"
+
+ get "/i/best" => "i#best"
+ get "/i/recent" => "i#recent"
+
+ get "/i/:id" => "users#show", :constraints => constraints
+ get "/(users)/:screen_name/status(es)/:id" => redirect("/i/%{id}")
+
+ get "/:screen_name(/:page)" => "users#best", :constraints => constraints
+ get "/:screen_name/best" => redirect("/%{screen_name}")
+ get "/users/:screen_name" => redirect("/%{screen_name}")
+
+ get "/:screen_name/discovered(/:page)" => "users#my", :constraints => constraints
+ get "/:screen_name/my(/:page)" => "users#my", :constraints => constraints
+ get "/users/:screen_name/discovered" => redirect("/%{screen_name}/discovered")
+
+ get "/:screen_name/timeline(/:page)" => "users#timeline", :constraints => constraints
+ get "/:screen_name/timeline/all(/:page)" => "users#timeline", :constraints => constraints, :defaults => {:tweets => "all"}
+ get "/users/:screen_name/recent" => redirect("/%{screen_name}/timeline")
+
+ get "/:screen_name/recent(/:page)" => "users#recent", :constraints => constraints
end
diff --git a/config/settings.yml b/config/settings.yml
index c165051..8c3650f 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -1,5 +1,7 @@
-consumer_key: <%= ENV["CONSUMER_KEY"] %>
-consumer_secret: <%= ENV["CONSUMER_SECRET"] %>
+#consumer:
+# - key: <%= ENV["CONSUMER_KEY"] %>
+# secret: <%= ENV["CONSUMER_SECRET"] %>
+consumer_version: 1
page_per: <%= ENV["ACLOG_PAGE_PER"] %>
worker_count: <%= ENV["ACLOG_WORKER_COUNT"] %>
secret_key: <%= ENV["ACLOG_SECRET_KEY"] %>