Skip to content

Commit

Permalink
Disable the Rails sandbox console
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiculescu committed Feb 14, 2024
1 parent f0f2efd commit 974b5d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ By default, sessions will be incinerated with a job 30 days after they are creat

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.

## `rails console --sandbox`

`console1984` will disable the Rails sandbox console, becuase it's not able to record sessions while in sandbox mode.

## Configuration

These config options are namespaced in `config.console1984`:
Expand Down
6 changes: 6 additions & 0 deletions lib/console1984/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class Engine < ::Rails::Engine
config.console1984.protected_environments ||= %i[ production ]
config.console1984.protected_urls ||= []

# Console 1984 doesn't work with the sandboxed Rails console, becuase
# it can't write its audit entries to the database.
initializer "console1984.disable_sandbox" do |app|
app.config.disable_sandbox = true
end

initializer "console1984.config" do
config.console1984.each do |key, value|
Console1984.config.send("#{key}=", value)
Expand Down

0 comments on commit 974b5d7

Please sign in to comment.