aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/configuration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/application/configuration.rb')
-rw-r--r--railties/lib/rails/application/configuration.rb30
1 files changed, 28 insertions, 2 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index 16fbc99e7a..b79dbdbc6f 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -18,7 +18,8 @@ module Rails
:session_options, :time_zone, :reload_classes_only_on_change,
:beginning_of_week, :filter_redirect, :x, :enable_dependency_loading,
:read_encrypted_secrets, :log_level, :content_security_policy_report_only,
- :content_security_policy_nonce_generator, :require_master_key, :credentials
+ :content_security_policy_nonce_generator, :require_master_key, :credentials,
+ :disable_sandbox
attr_reader :encoding, :api_only, :loaded_config_version, :autoloader
@@ -65,6 +66,7 @@ module Rails
@credentials.content_path = default_credentials_content_path
@credentials.key_path = default_credentials_key_path
@autoloader = :classic
+ @disable_sandbox = false
end
def load_defaults(target_version)
@@ -184,6 +186,26 @@ module Rails
end
end
+ # Load the database YAML without evaluating ERB. This allows us to
+ # create the rake tasks for multiple databases without filling in the
+ # configuration values or loading the environment. Do not use this
+ # method.
+ #
+ # This uses a DummyERB custom compiler so YAML can ignore the ERB
+ # tags and load the database.yml for the rake tasks.
+ def load_database_yaml # :nodoc:
+ if path = paths["config/database"].existent.first
+ require "rails/application/dummy_erb_compiler"
+
+ yaml = Pathname.new(path)
+ erb = DummyERB.new(yaml.read)
+
+ YAML.load(erb.result)
+ else
+ {}
+ end
+ end
+
# Loads and returns the entire raw configuration of database from
# values stored in <tt>config/database.yml</tt>.
def database_configuration
@@ -271,7 +293,11 @@ module Rails
end
def autoloader=(autoloader)
- if %i(classic zeitwerk).include?(autoloader)
+ case autoloader
+ when :classic
+ @autoloader = autoloader
+ when :zeitwerk
+ require "zeitwerk"
@autoloader = autoloader
else
raise ArgumentError, "config.autoloader may be :classic or :zeitwerk, got #{autoloader.inspect} instead"