Skip to content

Instantly share code, notes, and snippets.

@ezotrank
Created March 28, 2013 07:36
Show Gist options
  • Select an option

  • Save ezotrank/5261388 to your computer and use it in GitHub Desktop.

Select an option

Save ezotrank/5261388 to your computer and use it in GitHub Desktop.
Commit: d1554d7664fd93f9cbb963432218e748c7159ddc
Author: Maxim Kremenev <[email protected]>
Date: (9 minutes ago) 2013-03-28 14:27:46 +0700
Subject: Make more clear development and test environment config
* Add automatic logrotate on development and test envs by this trick http://goo.gl/sNLGV
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 6b213b2..c455765 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,21 +1,10 @@
NanoAviasalesRu::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
-
- # In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
- # since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
-
- # Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
-
- # Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
-
config.cache_store = :redis_store, AppConfig.cache_server
- # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :letter_opener
# config.action_mailer.delivery_method = :smtp
@@ -29,22 +18,13 @@ NanoAviasalesRu::Application.configure do
# enable_starttls_auto: true
# }
- # Print deprecation notices to the Rails logger
- config.active_support.deprecation = :log
+ config.logger = Logger.new(Rails.root.join("log", "#{Rails.env}.log"), 3, 5.megabyte)
- # Only use best-standards-support built into browsers
+ config.active_support.deprecation = :log
config.action_dispatch.best_standards_support = :builtin
-
- # Do not compress assets
config.assets.compress = false
-
- # Expands the lines which load the assets
config.assets.debug = true
- # Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
-
- # Log the query plan for queries taking more than this (works
- # with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 0aeada1..1710d61 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,43 +1,19 @@
NanoAviasalesRu::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
-
- # The test environment is used exclusively to run your application's
- # test suite. You never need to work with it otherwise. Remember that
- # your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
-
- # Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
-
config.i18n.locale = :ru
- # Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
-
config.cache_store = :redis_store, AppConfig.cache_server
-
- # Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
-
- # Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
- # Tell Action Mailer not to deliver emails to the real world.
- # The :test delivery method accumulates sent emails in the
- # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: 'localhost', utm_source: 'mail_test' }
- # Use SQL instead of Active Record's schema dumper when creating the test database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
+ config.logger = Logger.new(Rails.root.join("log", "#{Rails.env}.log"), 3, 5.megabyte)
- # Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
-
- # Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = 'public, max-age=3600'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment