From b4cf625971765d0d50b369492e106e0ae3c9806d Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 19 Mar 2014 15:46:16 +0600 Subject: [PATCH] [#345] small update config files; remove warning with secret_key_base --- bin/bundle | 3 +++ bin/rails | 4 ++++ bin/rake | 4 ++++ config/application.rb | 5 +---- config/boot.rb | 4 +--- config/environments/development.rb | 3 +++ config/initializers/filter_parameter_logging.rb | 4 ++++ config/initializers/secret_token.rb | 2 +- config/initializers/wrap_parameters.rb | 14 ++++++++++++++ 9 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 bin/bundle create mode 100644 bin/rails create mode 100644 bin/rake create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/wrap_parameters.rb diff --git a/bin/bundle b/bin/bundle new file mode 100644 index 000000000..66e9889e8 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100644 index 000000000..728cd85aa --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100644 index 000000000..17240489f --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/config/application.rb b/config/application.rb index 8c0e2210a..225efb3dd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,7 +8,7 @@ I18n.config.enforce_available_locales = true # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) module Rosa class Application < Rails::Application @@ -44,9 +44,6 @@ module Rosa # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password, :secret, :authentication_token] - # Enable the asset pipeline config.assets.enabled = true diff --git a/config/boot.rb b/config/boot.rb index 6397af4d8..310a0a36a 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,7 +1,5 @@ -require 'rubygems' - # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) ENV['NEWRELIC_DISPATCHER'] ||= 'puma' -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/config/environments/development.rb b/config/environments/development.rb index 09476e464..67dea41a3 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -43,6 +43,9 @@ Rosa::Application.configure do # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin + # Raise an error on page load if there are pending migrations + config.active_record.migration_error = :page_load + # Do not compress assets config.assets.compress = false diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 000000000..29a90e219 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password, :secret, :authentication_token] diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 5803b0700..90b96465b 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Rosa::Application.config.secret_token = APP_CONFIG['keys']['secret_token'] +Rosa::Application.config.secret_key_base = APP_CONFIG['keys']['secret_token'] diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..33725e95f --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end