Skip to content

Commit aa2e26f

Browse files
committed
Allow RAILS_ENV to override default environment of 'production'
MSP-10964
1 parent 38c6e2d commit aa2e26f

File tree

1 file changed

+4
-2
lines changed
  • lib/metasploit/framework/parsed_options

1 file changed

+4
-2
lines changed

lib/metasploit/framework/parsed_options/base.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ def options
8585
options.database.disable = false
8686
options.database.migrations_paths = []
8787

88+
# If RAILS_ENV is set, then it will be used, but if RAILS_ENV is set and the --environment option is given, then
89+
# --environment value will be used to reset ENV[RAILS_ENV].
90+
options.environment = ENV['RAILS_ENV'] || DEFAULT_ENVIRONMENT
91+
8892
options.framework = ActiveSupport::OrderedOptions.new
8993
options.framework.config = nil
9094

9195
options.modules = ActiveSupport::OrderedOptions.new
9296
options.modules.path = nil
9397

94-
options.environment = DEFAULT_ENVIRONMENT
95-
9698
@options = options
9799
end
98100

0 commit comments

Comments
 (0)