File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1
- 1.9.3-p484
1
+ 1.9.3-p547
Original file line number Diff line number Diff line change @@ -33,11 +33,22 @@ module Framework
33
33
class Application < Rails ::Application
34
34
include Metasploit ::Framework ::CommonEngine
35
35
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
41
52
end
42
53
end
43
54
end
You can’t perform that action at this time.
0 commit comments