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
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+35-14Lines changed: 35 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,57 +30,78 @@ class EventsController < ApplicationController
30
30
end
31
31
```
32
32
33
+
## Setting Configuration via Environment Variables
34
+
35
+
Inertia Rails supports setting any configuration option via environment variables out of the box. For each option in the configuration, you can set an environment variable prefixed with `INERTIA_` and the option name in uppercase. For example: `INERTIA_SSR_ENABLED`.
36
+
37
+
**Boolean values** (like `INERTIA_DEEP_MERGE_SHARED_DATA` or `INERTIA_SSR_ENABLED`) are parsed from the strings `"true"` or `"false"` (case-sensitive).
38
+
33
39
## Configuration Options
34
40
35
41
### `component_path_resolver`
36
42
37
-
Use `component_path_resolver` to customize component path resolution when [`default_render`](#default_render) config value is set to `true`. The value should be callable and will receive the `path` and `action` parameters, returning a string component path. See [Automatically determine component name](/guide/responses#automatically-determine-component-name).
Use `component_path_resolver` to customize component path resolution when [`default_render`](#default_render) config value is set to `true`. The value should be callable and will receive the `path` and `action` parameters, returning a string component path. See [Automatically determine component name](/guide/responses#automatically-determine-component-name).
46
+
41
47
### `deep_merge_shared_data`
42
48
49
+
**Default**: `false`
50
+
**ENV**: `INERTIA_DEEP_MERGE_SHARED_DATA`
51
+
43
52
When enabled, props will be deep merged with shared data, combining hashes
44
53
with the same keys instead of replacing them.
45
54
46
-
**Default**: `false`
47
-
48
55
### `default_render`
49
56
50
-
Overrides Rails default rendering behavior to render using Inertia by default.
57
+
**Default**: `false`
58
+
**ENV**: `INERTIA_DEFAULT_RENDER`
51
59
52
-
**Default**: `false`
60
+
Overrides Rails default rendering behavior to render using Inertia by default.
53
61
54
62
### `encrypt_history`
55
63
64
+
**Default**: `false`
65
+
**ENV**: `INERTIA_ENCRYPT_HISTORY`
66
+
56
67
When enabled, you instruct Inertia to encrypt your app's history, it uses
57
68
the browser's built-in [`crypto` api](https://developer.mozilla.org/en-US/docs/Web/API/Crypto)
58
69
to encrypt the current page's data before pushing it to the history state.
59
70
60
-
**Default**: `false`
61
-
62
71
### `ssr_enabled`_(experimental)_
63
72
73
+
**Default**: `false`
74
+
**ENV**: `INERTIA_SSR_ENABLED`
75
+
64
76
Whether to use a JavaScript server to pre-render your JavaScript pages,
65
77
allowing your visitors to receive fully rendered HTML when they first visit
66
78
your application.
67
79
68
80
Requires a JS server to be available at `ssr_url`. [_Example_](https://github.com/ElMassimo/inertia-rails-ssr-template)
69
81
70
-
**Default**: `false`
71
-
72
82
### `ssr_url`_(experimental)_
73
83
84
+
**Default**: `"http://localhost:13714"`
85
+
**ENV**: `INERTIA_SSR_URL`
86
+
74
87
The URL of the JS server that will pre-render the app using the specified
75
88
component and props.
76
89
77
-
**Default**: `"http://localhost:13714"`
78
-
79
90
### `version`_(recommended)_
80
91
92
+
**Default**: `nil`
93
+
**ENV**: `INERTIA_VERSION`
94
+
81
95
This allows Inertia to detect if the app running in the client is oudated,
82
96
forcing a full page visit instead of an XHR visit on the next request.
83
97
84
-
See [assets versioning](https://inertiajs.com/asset-versioning).
98
+
See [assets versioning](/guide/asset-versioning).
85
99
86
-
**Default**: `nil`
100
+
### `parent_controller`
101
+
102
+
**Default**: `'::ApplicationController'`
103
+
**ENV**: `INERTIA_PARENT_CONTROLLER`
104
+
105
+
Specifies the base controller class for the internal `StaticController` used to render [Shorthand routes](/guide/routing#shorthand-routes).
106
+
107
+
By default, Inertia Rails creates a `StaticController` that inherits from `ApplicationController`. You can use this option to specify a different base controller (for example, to include custom authentication, layout, or before actions).
0 commit comments