Skip to content

Commit b910dfb

Browse files
committed
Merge remote-tracking branch 'upstream/staging/electro-release' into staging/electro-release
2 parents 2818b4e + 69e8edf commit b910dfb

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9.3-p484
1+
1.9.3-p547

config/application.rb

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,22 @@ module Framework
3333
class Application < Rails::Application
3434
include Metasploit::Framework::CommonEngine
3535

36-
user_config_root = Pathname.new(Msf::Config.get_config_root)
37-
user_database_yaml = user_config_root.join('database.yml')
38-
39-
if user_database_yaml.exist?
40-
config.paths['config/database'] = [user_database_yaml.to_path]
36+
environment_database_yaml = ENV['MSF_DATABASE_CONFIG']
37+
38+
if environment_database_yaml
39+
# DO NOT check if the path exists: if the environment variable is set, then the user meant to use this path
40+
# and if it doesn't exist then an error should occur so the user knows the environment variable points to a
41+
# non-existent file.
42+
config.paths['config/database'] = environment_database_yaml
43+
else
44+
user_config_root = Pathname.new(Msf::Config.get_config_root)
45+
user_database_yaml = user_config_root.join('database.yml')
46+
47+
# DO check if the path exists as in test environments there may be no config root, in which case the normal
48+
# rails location, `config/database.yml`, should contain the database config.
49+
if user_database_yaml.exist?
50+
config.paths['config/database'] = [user_database_yaml.to_path]
51+
end
4152
end
4253
end
4354
end

0 commit comments

Comments
 (0)