From 974b5d70d2e0e98c2828678c856e7ad7edf250bd Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 14 Feb 2024 11:41:53 +1000 Subject: [PATCH 1/3] Disable the Rails sandbox console --- README.md | 4 ++++ lib/console1984/engine.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 76ad901..a742fcb 100644 --- a/README.md +++ b/README.md @@ -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`: diff --git a/lib/console1984/engine.rb b/lib/console1984/engine.rb index da99444..e5295c5 100644 --- a/lib/console1984/engine.rb +++ b/lib/console1984/engine.rb @@ -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) From 05ebf86009befabb37b88908b0a5d92522149da1 Mon Sep 17 00:00:00 2001 From: Alex Ghiculescu Date: Thu, 22 Aug 2024 09:14:37 +1000 Subject: [PATCH 2/3] Update README.md Co-authored-by: Neil Carvalho --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a742fcb..137187b 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ When starting a console session, `console1984` will eager load all the applicati ## `rails console --sandbox` -`console1984` will disable the Rails sandbox console, becuase it's not able to record sessions while in sandbox mode. +`console1984` will disable the Rails sandbox console, because it's not able to record sessions while in sandbox mode. ## Configuration From 2d4d673c26753adda9015cee91b850b460d15ca6 Mon Sep 17 00:00:00 2001 From: Alex Ghiculescu Date: Thu, 22 Aug 2024 09:14:43 +1000 Subject: [PATCH 3/3] Update lib/console1984/engine.rb Co-authored-by: Neil Carvalho --- lib/console1984/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/console1984/engine.rb b/lib/console1984/engine.rb index e5295c5..2a11936 100644 --- a/lib/console1984/engine.rb +++ b/lib/console1984/engine.rb @@ -8,7 +8,7 @@ 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 + # Console 1984 doesn't work with the sandboxed Rails console, because # it can't write its audit entries to the database. initializer "console1984.disable_sandbox" do |app| app.config.disable_sandbox = true