Skip to content

Commit db0f2a4

Browse files
committed
Add docs for all Application::Configuration attr
Previously, there was a small amount of grouping of related config options. However, the lack of an ordered list made options feel less discoverable than when they are sorted. In addition, filled in descriptions for a number of config options that were missing.
1 parent e377e02 commit db0f2a4

File tree

2 files changed

+115
-1
lines changed

2 files changed

+115
-1
lines changed

guides/source/configuring.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,20 @@ config.after_initialize do
169169
end
170170
```
171171

172+
#### `config.allow_concurrency`
173+
174+
Controls whether requests should be handled concurrently. This should only
175+
be set to `false` if application code is not thread safe. Defaults to `true`.
176+
172177
#### `config.asset_host`
173178

174179
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`.
175180

181+
#### `config.autoflush_log`
182+
183+
Enables writing log file output immediately instead of buffering. Defaults to
184+
`true`.
185+
176186
#### `config.autoload_once_paths`
177187

178188
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.
@@ -215,6 +225,19 @@ console do
215225
end
216226
```
217227

228+
#### `config.content_security_policy_nonce_directives`
229+
230+
See [Adding a Nonce](security.html#adding-a-nonce) in the Security Guide
231+
232+
#### `config.content_security_policy_nonce_generator`
233+
234+
See [Adding a Nonce](security.html#adding-a-nonce) in the Security Guide
235+
236+
#### `config.content_security_policy_report_only`
237+
238+
See [Reporting Violations](security.html#reporting-violations) in the Security
239+
Guide
240+
218241
#### `config.credentials.content_path`
219242

220243
Configures lookup path for encrypted credentials.
@@ -277,10 +300,37 @@ Rails.application.config.filter_parameters += [
277300

278301
Parameters filter works by partial matching regular expression.
279302

303+
#### `config.filter_redirect`
304+
305+
Used for filtering out redirect urls from application logs.
306+
307+
```ruby
308+
Rails.application.config.filter_redirect += ['s3.amazonaws.com', /private-match/]
309+
```
310+
311+
The redirect filter works by testing that urls include strings or match regular
312+
expressions.
313+
280314
#### `config.force_ssl`
281315

282316
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`.
283317

318+
#### `config.helpers_paths`
319+
320+
Defines an array of additional paths to load view helpers.
321+
322+
#### `config.host_authorization`
323+
324+
Accepts a hash of options to configure the [HostAuthorization
325+
middleware](#actiondispatch-hostauthorization)
326+
327+
#### `config.hosts`
328+
329+
An array of strings, regular expressions, or `IPAddr` used to validate the
330+
`Host` header. Used by the [HostAuthorization
331+
middleware](#actiondispatch-hostauthorization) to help prevent DNS rebinding
332+
attacks.
333+
284334
#### `config.javascript_path`
285335

286336
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`.
@@ -327,10 +377,33 @@ Allows you to configure the application's middleware. This is covered in depth i
327377

328378
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.
329379

380+
#### `config.railties_order`
381+
382+
Allows manually specifying the order that Railties/Engines are loaded. The
383+
default value is `[:all]`.
384+
385+
```ruby
386+
config.railties_order = [Blog::Engine, :main_app, :all]
387+
```
388+
330389
#### `config.rake_eager_load`
331390

332391
When `true`, eager load the application when running Rake tasks. Defaults to `false`.
333392

393+
#### `config.read_encrypted_secrets`
394+
395+
*DEPRECATED*: You should be using
396+
[credentials](https://guides.rubyonrails.org/security.html#custom-credentials)
397+
instead of encrypted secrets.
398+
399+
When `true`, will try to read encrypted secrets from `config/secrets.yml.enc`
400+
401+
#### `config.relative_url_root`
402+
403+
Can be used to tell Rails that you are [deploying to a subdirectory](
404+
configuring.html#deploy-to-a-subdirectory-relative-url-root). The default
405+
is `ENV['RAILS_RELATIVE_URL_ROOT']`.
406+
334407
#### `config.reload_classes_only_on_change`
335408

336409
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.
@@ -347,6 +420,21 @@ in `config/credentials.yml.enc`. See the [`secret_key_base` API documentation](
347420
https://api.rubyonrails.org/classes/Rails/Application.html#method-i-secret_key_base)
348421
for more information and alternative configuration methods.
349422

423+
#### `config.server_timing`
424+
425+
When `true`, adds the [ServerTiming middleware](#actiondispatch-servertiming)
426+
to the middleware stack
427+
428+
#### `config.session_options`
429+
430+
Additional options passed to `config.session_store`. You should use
431+
`config.session_store` to set this instead of modifying it yourself.
432+
433+
```ruby
434+
config.session_store :cookie_store, key: "_your_app_session"
435+
config.session_options # => {key: "_your_app_session"}
436+
```
437+
350438
#### `config.session_store`
351439

352440
Specifies what class to use to store the session. Possible values are `:cache_store`, `:cookie_store`, `:mem_cache_store`, a custom store, or `:disabled`. `:disabled` tells Rails not to deal with sessions.
@@ -381,6 +469,17 @@ The default value depends on the `config.load_defaults` target version:
381469

382470
Sets the default time zone for the application and enables time zone awareness for Active Record.
383471

472+
#### `config.x`
473+
474+
Used to easily add nested custom configuration to the application config object
475+
476+
```ruby
477+
config.x.payment_processing.schedule = :daily
478+
Rails.configuration.x.payment_processing.schedule # => :daily
479+
```
480+
481+
See [Custom Configuration](#custom-configuration)
482+
384483
### Configuring Assets
385484

386485
#### `config.assets.css_compressor`
@@ -542,6 +641,11 @@ Rails.application.config.host_authorization = {
542641
}
543642
```
544643

644+
#### `ActionDispatch::ServerTiming`
645+
646+
Adds metrics to the `Server-Timing` header to be viewed in the dev tools of a
647+
browser.
648+
545649
#### `ActionDispatch::SSL`
546650

547651
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`.
@@ -1158,7 +1262,9 @@ The default value depends on the `config.load_defaults` target version:
11581262

11591263
#### `config.action_controller.relative_url_root`
11601264

1161-
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']`.
1265+
Can be used to tell Rails that you are [deploying to a subdirectory](
1266+
configuring.html#deploy-to-a-subdirectory-relative-url-root). The default is
1267+
[`config.relative_url_root`](#config-relative-url-root).
11621268

11631269
#### `config.action_controller.permit_all_parameters`
11641270

guides/source/security.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,14 @@ This generation method is compatible with ETags, however its security depends on
12531253
the session id being sufficiently random and not being exposed in insecure
12541254
cookies.
12551255

1256+
By default, nonces will be applied to `script-src` and `style-src` if a nonce
1257+
generator is defined. `config.content_security_policy_nonce_directives` can be
1258+
used to change which directives will use nonces:
1259+
1260+
```ruby
1261+
Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
1262+
```
1263+
12561264
Once nonce generation is configured in an initializer, automatic nonce values
12571265
can be added to script tags by passing `nonce: true` as part of `html_options`:
12581266

0 commit comments

Comments
 (0)