Skip to content

Commit f437d77

Browse files
committed
Disable the Rails sandbox console
1 parent f0f2efd commit f437d77

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ By default, sessions will be incinerated with a job 30 days after they are creat
139139

140140
When starting a console session, `console1984` will eager load all the application classes if necessary. In practice, production environments already load classes eagerly, so this won't represent any change for those.
141141

142+
## `rails console --sandbox`
143+
144+
`console1984` will disable the Rails sandbox console, becuase it's not able to record sessions while in sandbox mode.
145+
142146
## Configuration
143147

144148
These config options are namespaced in `config.console1984`:

lib/console1984/engine.rb

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ class Engine < ::Rails::Engine
88
config.console1984.protected_environments ||= %i[ production ]
99
config.console1984.protected_urls ||= []
1010

11+
# Console 1984 doesn't work with the sandboxed Rails console, becuase
12+
# it can't write its audit entries to the database. Unless you've explicitly
13+
# said so, we disable the sandboxed console to prevent this issue.
14+
initializer "console1984.disable_sandbox" do |app|
15+
app.config.disable_sandbox = true
16+
end
17+
1118
initializer "console1984.config" do
1219
config.console1984.each do |key, value|
1320
Console1984.config.send("#{key}=", value)

0 commit comments

Comments
 (0)