diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-11-02 20:27:51 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-11-03 14:57:54 -0200 |
commit | 4faa0418453055bc81456685d418d486252cc379 (patch) | |
tree | acf0453393b953c6fd4c2145ef70ded6c9baeb05 /railties | |
parent | c2a7956eb7fbc099ea38d21601d215ab3def27fb (diff) | |
download | rails-4faa0418453055bc81456685d418d486252cc379.tar.gz rails-4faa0418453055bc81456685d418d486252cc379.tar.bz2 rails-4faa0418453055bc81456685d418d486252cc379.zip |
Rename secret_token_key to secret_key_base
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application.rb | 12 | ||||
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt | 4 | ||||
-rw-r--r-- | railties/test/abstract_unit.rb | 2 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 4 | ||||
-rw-r--r-- | railties/test/application/url_generation_test.rb | 2 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 4 |
7 files changed, 16 insertions, 16 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index f484e1737c..b7844bbfbe 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -109,8 +109,8 @@ module Rails # number of iterations selected based on consultation with the google security # team. Details at https://github.com/rails/rails/pull/6952#issuecomment-7661220 @caching_key_generator ||= begin - if config.secret_token_key - key_generator = ActiveSupport::KeyGenerator.new(config.secret_token_key, iterations: 1000) + if config.secret_key_base + key_generator = ActiveSupport::KeyGenerator.new(config.secret_key_base, iterations: 1000) ActiveSupport::CachingKeyGenerator.new(key_generator) else ActiveSupport::DummyKeyGenerator.new(config.secret_token) @@ -137,12 +137,12 @@ module Rails # def env_config @env_config ||= begin - if config.secret_token_key.nil? - ActiveSupport::Deprecation.warn "You didn't set config.secret_token_key. " + + if config.secret_key_base.nil? + ActiveSupport::Deprecation.warn "You didn't set config.secret_key_base. " + "This should be used instead of the old deprecated config.secret_token. " + - "Set config.secret_token_key instead of config.secret_token in config/initializers/secret_token.rb" + "Set config.secret_key_base instead of config.secret_token in config/initializers/secret_token.rb" if config.secret_token.blank? - raise "You must set config.secret_token_key in your app's config" + raise "You must set config.secret_key_base in your app's config" end end diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 0faa62c86c..f97e66985c 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -10,7 +10,7 @@ module Rails :cache_classes, :cache_store, :consider_all_requests_local, :console, :eager_load, :exceptions_app, :file_watcher, :filter_parameters, :force_ssl, :helpers_paths, :logger, :log_formatter, :log_tags, - :railties_order, :relative_url_root, :secret_token, :secret_token_key, + :railties_order, :relative_url_root, :secret_key_base, :secret_token, :serve_static_assets, :ssl_options, :static_cache_control, :session_options, :time_zone, :reload_classes_only_on_change, :queue, :queue_consumer, :beginning_of_week @@ -47,7 +47,7 @@ module Rails @queue_consumer = nil @eager_load = nil @secret_token = nil - @secret_token_key = nil + @secret_key_base = nil @assets = ActiveSupport::OrderedOptions.new @assets.enabled = false diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt index d96185ae2a..e5caab3672 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt @@ -7,6 +7,6 @@ # no regular words or you'll be exposed to dictionary attacks. # You can use `rake secret` to generate a secure secret key. -# Make sure your secret_token_key is kept private +# Make sure your secret_key_base is kept private # if you're sharing your code publicly. -<%= app_const %>.config.secret_token_key = '<%= app_secret %>' +<%= app_const %>.config.secret_key_base = '<%= app_secret %>' diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 486cc64137..2ea1d2aff4 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -14,6 +14,6 @@ require 'rails/all' module TestApp class Application < Rails::Application config.root = File.dirname(__FILE__) - config.secret_token_key = 'b3c631c314c0bbca50c1b2843150fe33' + config.secret_key_base = 'b3c631c314c0bbca50c1b2843150fe33' end end diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 5d654e1be6..b9d18f4582 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -225,9 +225,9 @@ module ApplicationTests assert_equal Pathname.new(app_path).join("somewhere"), Rails.public_path end - test "Use key_generator when secret_token_key is set" do + test "Use key_generator when secret_key_base is set" do make_basic_app do |app| - app.config.secret_token_key = 'b3c631c314c0bbca50c1b2843150fe33' + app.config.secret_key_base = 'b3c631c314c0bbca50c1b2843150fe33' app.config.session_store :disabled end diff --git a/railties/test/application/url_generation_test.rb b/railties/test/application/url_generation_test.rb index fb83659b0c..0905757442 100644 --- a/railties/test/application/url_generation_test.rb +++ b/railties/test/application/url_generation_test.rb @@ -14,7 +14,7 @@ module ApplicationTests require "action_controller/railtie" class MyApp < Rails::Application - config.secret_token_key = "3b7cd727ee24e8444053437c36cc66c4" + config.secret_key_base = "3b7cd727ee24e8444053437c36cc66c4" config.session_store :cookie_store, key: "_myapp_session" config.active_support.deprecation = :log config.eager_load = false diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 2c92f2ded5..0cb65f8e0d 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -119,7 +119,7 @@ module TestHelpers add_to_config <<-RUBY config.eager_load = false - config.secret_token_key = "3b7cd727ee24e8444053437c36cc66c4" + config.secret_key_base = "3b7cd727ee24e8444053437c36cc66c4" config.session_store :cookie_store, key: "_myapp_session" config.active_support.deprecation = :log config.action_controller.allow_forgery_protection = false @@ -138,7 +138,7 @@ module TestHelpers app = Class.new(Rails::Application) app.config.eager_load = false - app.config.secret_token_key = "3b7cd727ee24e8444053437c36cc66c4" + app.config.secret_key_base = "3b7cd727ee24e8444053437c36cc66c4" app.config.session_store :cookie_store, key: "_myapp_session" app.config.active_support.deprecation = :log |