File tree Expand file tree Collapse file tree 5 files changed +14
-1
lines changed
dummy/config/environments Expand file tree Collapse file tree 5 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def secrets=(secrets)
2020 end
2121
2222 class Railtie < ::Rails ::Railtie
23- config . before_initialize do |app |
23+ config . before_configuration do |app |
2424 app . paths . add "config/secrets" , with : "config/secrets.yml"
2525 app . extend ( InstanceMethods )
2626 end
Original file line number Diff line number Diff line change 2626 # This option may cause significant delays in view rendering with a large
2727 # number of complex assets.
2828 config . assets . debug = true
29+
30+ # Test whether secrets can be read in a configuration context
31+ config . secret_environment_config = Rails . application . secrets . secret_key_base
2932end
Original file line number Diff line number Diff line change 7777
7878 # Use default logging formatter so that PID and timestamp are not suppressed.
7979 config . log_formatter = ::Logger ::Formatter . new
80+
81+ # Test whether secrets can be read in a configuration context
82+ config . secret_environment_config = Rails . application . secrets . secret_key_base
8083end
Original file line number Diff line number Diff line change 3333
3434 # Print deprecation notices to the stderr.
3535 config . active_support . deprecation = :stderr
36+
37+ # Test whether secrets can be read in a configuration context
38+ config . secret_environment_config = Rails . application . secrets . secret_key_base
3639end
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ class RailsSecretsTest < ActiveSupport::TestCase
88 assert_equal "9f4a992" , app . secrets . api_token
99 end
1010
11+ test "a config value set in the configuration stage is set to the correct value" do
12+ assert_equal app . secrets . secret_key_base , app . config . secret_environment_config
13+ end
14+
1115 test "config.secret_key_base is copied from secrets.secret_key_base" do
1216 assert_equal app . secrets . secret_key_base , app . config . secret_key_base
1317 end
You can’t perform that action at this time.
0 commit comments