You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -147,6 +147,17 @@ Below are the default values associated with each target version. In cases of co
147
147
148
148
The following configuration methods are to be called on a `Rails::Railtie` object, such as a subclass of `Rails::Engine` or `Rails::Application`.
149
149
150
+
#### `config.add_autoload_paths_to_load_path`
151
+
152
+
Says whether autoload paths have to be added to `$LOAD_PATH`. It is recommended to be set to `false` in `:zeitwerk` mode early, in `config/application.rb`. Zeitwerk uses absolute paths internally, and applications running in `:zeitwerk` mode do not need `require_dependency`, so models, controllers, jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves Ruby from checking these directories when resolving `require` calls with relative paths, and saves Bootsnap work and RAM, since it does not need to build an index for them.
153
+
154
+
The default value depends on the `config.load_defaults` target version:
155
+
156
+
| Starting with version | The default value is |
157
+
| --------------------- | -------------------- |
158
+
| (original) |`true`|
159
+
| 7.1 |`false`|
160
+
150
161
#### `config.after_initialize`
151
162
152
163
Takes a block which will be run _after_ Rails has finished initializing the application. That includes the initialization of the framework itself, engines, and all the application's initializers in `config/initializers`. Note that this block _will_ be run for rake tasks. Useful for configuring values set up by other initializers:
@@ -157,10 +168,20 @@ config.after_initialize do
157
168
end
158
169
```
159
170
171
+
#### `config.allow_concurrency`
172
+
173
+
Controls whether requests should be handled concurrently. This should only
174
+
be set to `false` if application code is not thread safe. Defaults to `true`.
175
+
160
176
#### `config.asset_host`
161
177
162
178
Sets the host for the assets. Useful when CDNs are used for hosting assets, or when you want to work around the concurrency constraints built-in in browsers using different domain aliases. Shorter version of `config.action_controller.asset_host`.
163
179
180
+
#### `config.autoflush_log`
181
+
182
+
Enables writing log file output immediately instead of buffering. Defaults to
183
+
`true`.
184
+
164
185
#### `config.autoload_once_paths`
165
186
166
187
Accepts an array of paths from which Rails will autoload constants that won't be wiped per request. Relevant if reloading is enabled, which it is by default in the `development` environment. Otherwise, all autoloading happens only once. All elements of this array must also be in `autoload_paths`. Default is an empty array.
@@ -169,32 +190,15 @@ Accepts an array of paths from which Rails will autoload constants that won't be
169
190
170
191
Accepts an array of paths from which Rails will autoload constants. Default is an empty array. Since [Rails 6](upgrading_ruby_on_rails.html#autoloading), it is not recommended to adjust this. See [Autoloading and Reloading Constants](autoloading_and_reloading_constants.html#autoload-paths).
171
192
172
-
#### `config.add_autoload_paths_to_load_path`
173
-
174
-
Says whether autoload paths have to be added to `$LOAD_PATH`. It is recommended to be set to `false` in `:zeitwerk` mode early, in `config/application.rb`. Zeitwerk uses absolute paths internally, and applications running in `:zeitwerk` mode do not need `require_dependency`, so models, controllers, jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves Ruby from checking these directories when resolving `require` calls with relative paths, and saves Bootsnap work and RAM, since it does not need to build an index for them.
175
-
176
-
The default value depends on the `config.load_defaults` target version:
177
-
178
-
| Starting with version | The default value is |
179
-
| --------------------- | -------------------- |
180
-
| (original) |`true`|
181
-
| 7.1 |`false`|
182
-
183
-
#### `config.enable_reloading`
184
-
185
-
If `config.enable_reloading` is true, application classes and modules are reloaded in between web requests if they change. Defaults to `true` in the `development` environment, and `false` in the `production` environment.
193
+
#### `config.beginning_of_week`
186
194
187
-
The predicate `config.reloading_enabled?` is also defined.
195
+
Sets the default beginning of week for the
196
+
application. Accepts a valid day of week as a symbol (e.g. `:monday`).
188
197
189
198
#### `config.cache_classes`
190
199
191
200
Old setting equivalent to `!config.enable_reloading`. Supported for backwards compatibility.
192
201
193
-
#### `config.beginning_of_week`
194
-
195
-
Sets the default beginning of week for the
196
-
application. Accepts a valid day of week as a symbol (e.g. `:monday`).
197
-
198
202
#### `config.cache_store`
199
203
200
204
Configures which cache store to use for Rails caching. Options include one of the symbols `:memory_store`, `:file_store`, `:mem_cache_store`, `:null_store`, `:redis_cache_store`, or an object that implements the cache API. Defaults to `:file_store`. See [Cache Stores](caching_with_rails.html#cache-stores) for per-store configuration options.
See [Adding a Nonce](security.html#adding-a-nonce) in the Security Guide
234
+
235
+
#### `config.content_security_policy_report_only`
236
+
237
+
See [Reporting Violations](security.html#reporting-violations) in the Security
238
+
Guide
239
+
240
+
#### `config.credentials.content_path`
241
+
242
+
Configures lookup path for encrypted credentials.
243
+
244
+
#### `config.credentials.key_path`
245
+
246
+
Configures lookup path for encryption key.
247
+
248
+
#### `config.debug_exception_response_format`
249
+
250
+
Sets the format used in responses when errors occur in the development environment. Defaults to `:api` for API only apps and `:default` for normal apps.
251
+
223
252
#### `config.disable_sandbox`
224
253
225
254
Controls whether or not someone can start a console in sandbox mode. This is helpful to avoid a long running session of sandbox console, that could lead a database server to run out of memory. Defaults to `false`.
@@ -236,6 +265,12 @@ Registers namespaces that are eager loaded when `config.eager_load` is set to `t
236
265
237
266
Accepts an array of paths from which Rails will eager load on boot if `config.eager_load` is true. Defaults to every folder in the `app` directory of the application.
238
267
268
+
#### `config.enable_reloading`
269
+
270
+
If `config.enable_reloading` is true, application classes and modules are reloaded in between web requests if they change. Defaults to `true` in the `development` environment, and `false` in the `production` environment.
271
+
272
+
The predicate `config.reloading_enabled?` is also defined.
273
+
239
274
#### `config.encoding`
240
275
241
276
Sets up the application-wide encoding. Defaults to UTF-8.
@@ -244,10 +279,6 @@ Sets up the application-wide encoding. Defaults to UTF-8.
244
279
245
280
Sets the exceptions application invoked by the `ShowException` middleware when an exception happens. Defaults to `ActionDispatch::PublicExceptions.new(Rails.public_path)`.
246
281
247
-
#### `config.debug_exception_response_format`
248
-
249
-
Sets the format used in responses when errors occur in the development environment. Defaults to `:api` for API only apps and `:default` for normal apps.
250
-
251
282
#### `config.file_watcher`
252
283
253
284
Is the class used to detect file updates in the file system when `config.reload_classes_only_on_change` is `true`. Rails ships with `ActiveSupport::FileUpdateChecker`, the default, and `ActiveSupport::EventedFileUpdateChecker` (this one depends on the [listen](https://github.com/guard/listen) gem). Custom classes must conform to the `ActiveSupport::FileUpdateChecker` API.
The redirect filter works by testing that urls include strings or match regular
311
+
expressions.
312
+
271
313
#### `config.force_ssl`
272
314
273
315
Forces all requests to be served over HTTPS, and sets "https://" as the default protocol when generating URLs. Enforcement of HTTPS is handled by the `ActionDispatch::SSL` middleware, which can be configured via `config.ssl_options`.
274
316
317
+
#### `config.helpers_paths`
318
+
319
+
Defines an array of additional paths to load view helpers.
320
+
321
+
#### `config.host_authorization`
322
+
323
+
Accepts a hash of options to configure the [HostAuthorization
324
+
middleware](#actiondispatch-hostauthorization)
325
+
326
+
#### `config.hosts`
327
+
328
+
An array of strings, regular expressions, or `IPAddr` used to validate the
329
+
`Host` header. Used by the [HostAuthorization
330
+
middleware](#actiondispatch-hostauthorization) to help prevent DNS rebinding
331
+
attacks.
332
+
275
333
#### `config.javascript_path`
276
334
277
335
Sets the path where your app's JavaScript lives relative to the `app` directory. The default is `javascript`, used by [webpacker](https://github.com/rails/webpacker). An app's configured `javascript_path` will be excluded from `autoload_paths`.
Allows you to configure the application's middleware. This is covered in depth in the [Configuring Middleware](#configuring-middleware) section below.
316
374
375
+
#### `config.public_file_server.enabled`
376
+
377
+
Configures Rails to serve static files from the public directory. This option defaults to `true`, but in the production environment it is set to `false` because the server software (e.g. NGINX or Apache) used to run the application should serve static files instead. If you are running or testing your app in production using WEBrick (it is not recommended to use WEBrick in production) set the option to `true`. Otherwise, you won't be able to use page caching and request for files that exist under the public directory.
378
+
379
+
#### `config.railties_order`
380
+
381
+
Allows manually specifying the order that Railties/Engines are loaded. The
When `true`, eager load the application when running Rake tasks. Defaults to `false`.
320
391
321
-
#### `config.reload_classes_only_on_change`
392
+
#### `config.read_encrypted_secrets`
322
393
323
-
Enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to `true`. If `config.enable_reloading` is `false`, this option is ignored.
When `true`, will try to read encrypted secrets from `config/secrets.yml.enc`
326
399
327
-
Configures lookup path for encrypted credentials.
400
+
#### `config.relative_url_root`
328
401
329
-
#### `config.credentials.key_path`
402
+
Can be used to tell Rails that you are [deploying to a subdirectory](
403
+
configuring.html#deploy-to-a-subdirectory-relative-url-root). The default
404
+
is `ENV['RAILS_RELATIVE_URL_ROOT']`.
330
405
331
-
Configures lookup path for encryption key.
406
+
#### `config.reload_classes_only_on_change`
407
+
408
+
Enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to `true`. If `config.enable_reloading` is `false`, this option is ignored.
409
+
410
+
#### `config.require_master_key`
411
+
412
+
Causes the app to not boot if a master key hasn't been made available through `ENV["RAILS_MASTER_KEY"]` or the `config/master.key` file.
332
413
333
414
#### `config.secret_key_base`
334
415
@@ -338,13 +419,20 @@ in `config/credentials.yml.enc`. See the [`secret_key_base` API documentation](
for more information and alternative configuration methods.
340
421
341
-
#### `config.require_master_key`
422
+
#### `config.server_timing`
342
423
343
-
Causes the app to not boot if a master key hasn't been made available through `ENV["RAILS_MASTER_KEY"]` or the `config/master.key` file.
424
+
When `true`, adds the [ServerTiming middleware](#actiondispatch-servertiming)
425
+
to the middleware stack
344
426
345
-
#### `config.public_file_server.enabled`
427
+
#### `config.session_options`
346
428
347
-
Configures Rails to serve static files from the public directory. This option defaults to `true`, but in the production environment it is set to `false` because the server software (e.g. NGINX or Apache) used to run the application should serve static files instead. If you are running or testing your app in production using WEBrick (it is not recommended to use WEBrick in production) set the option to `true`. Otherwise, you won't be able to use page caching and request for files that exist under the public directory.
429
+
Additional options passed to `config.session_store`. You should use
430
+
`config.session_store` to set this instead of modifying it yourself.
Adds metrics to the `Server-Timing` header to be viewed in the dev tools of a
646
+
browser.
647
+
544
648
#### `ActionDispatch::SSL`
545
649
546
650
Forces every request to be served using HTTPS. Enabled if `config.force_ssl` is set to `true`. Options passed to this can be configured by setting `config.ssl_options`.
@@ -1168,7 +1272,9 @@ The default value depends on the `config.load_defaults` target version:
1168
1272
1169
1273
#### `config.action_controller.relative_url_root`
1170
1274
1171
-
Can be used to tell Rails that you are [deploying to a subdirectory](configuring.html#deploy-to-a-subdirectory-relative-url-root). The default is `ENV['RAILS_RELATIVE_URL_ROOT']`.
1275
+
Can be used to tell Rails that you are [deploying to a subdirectory](
1276
+
configuring.html#deploy-to-a-subdirectory-relative-url-root). The default is
0 commit comments