From f6479643329ef957c41aa43c2e73bfe279264932 Mon Sep 17 00:00:00 2001 From: Roman Samoilov <2270393+rsamoilov@users.noreply.github.com> Date: Fri, 23 Aug 2024 18:51:42 +0100 Subject: [PATCH] Correctly set Rails env this fixes the bug where if launching the Rage server with the -e option, Rails would still think it's running in development --- lib/rage/cli.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rage/cli.rb b/lib/rage/cli.rb index 5e24555..5ff0631 100644 --- a/lib/rage/cli.rb +++ b/lib/rage/cli.rb @@ -127,6 +127,10 @@ def environment def set_env(options) ENV["RAGE_ENV"] = options[:environment] if options[:environment] + + # at this point we don't know whether the app is running in standalone or Rails mode; + # we set both variables to make sure applications are running in the same environment; + ENV["RAILS_ENV"] = ENV["RAGE_ENV"] if ENV["RAGE_ENV"] && ENV["RAILS_ENV"] != ENV["RAGE_ENV"] end end