Skip to content

Commit 6792ded

Browse files
author
Tod Beardsley
committed
Land rapid7#3666, fix msfconsole start w/out database
2 parents 7c1605e + b9e449f commit 6792ded

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/metasploit/framework/require.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ def self.optionally(name, without_warning)
4949
#
5050
# @return [void]
5151
def self.optionally_active_record_railtie
52-
optionally(
52+
if ::File.exist?(Rails.application.config.paths['config/database'].first)
53+
optionally(
5354
'active_record/railtie',
5455
'activerecord not in the bundle, so database support will be disabled.'
55-
)
56+
)
57+
else
58+
warn 'Could not find database.yml, so database support will be disabled.'
59+
end
5660
end
5761

5862
# Tries to `require 'metasploit/credential/creation'` and include it in the `including_module`.
@@ -89,4 +93,4 @@ def optionally_include_metasploit_credential_creation
8993
end
9094
end
9195
end
92-
end
96+
end

0 commit comments

Comments
 (0)