2014-05-12 20:03:51 +00:00
|
|
|
require 'rails'
|
|
|
|
require File.expand_path('../boot', __FILE__)
|
|
|
|
|
2014-07-29 20:50:52 +00:00
|
|
|
all_environments = [
|
|
|
|
:development,
|
|
|
|
:production,
|
|
|
|
:test
|
|
|
|
]
|
|
|
|
|
|
|
|
Bundler.require(
|
|
|
|
*Rails.groups(
|
|
|
|
db: all_environments,
|
|
|
|
pcap: all_environments
|
|
|
|
)
|
|
|
|
)
|
2014-05-12 20:03:51 +00:00
|
|
|
|
2014-08-05 01:12:28 +00:00
|
|
|
#
|
|
|
|
# Railties
|
|
|
|
#
|
|
|
|
|
|
|
|
# For compatibility with jquery-rails (and other engines that need action_view) in pro
|
|
|
|
require 'action_view/railtie'
|
|
|
|
|
2014-06-02 17:57:48 +00:00
|
|
|
#
|
|
|
|
# Project
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'metasploit/framework/common_engine'
|
2014-05-12 20:03:51 +00:00
|
|
|
require 'msf/base/config'
|
|
|
|
|
|
|
|
module Metasploit
|
|
|
|
module Framework
|
|
|
|
class Application < Rails::Application
|
2014-06-02 17:57:48 +00:00
|
|
|
include Metasploit::Framework::CommonEngine
|
|
|
|
|
2014-08-05 15:16:33 +00:00
|
|
|
environment_database_yaml = ENV['MSF_DATABASE_CONFIG']
|
|
|
|
|
|
|
|
if environment_database_yaml
|
|
|
|
# DO NOT check if the path exists: if the environment variable is set, then the user meant to use this path
|
|
|
|
# and if it doesn't exist then an error should occur so the user knows the environment variable points to a
|
|
|
|
# non-existent file.
|
|
|
|
config.paths['config/database'] = environment_database_yaml
|
|
|
|
else
|
|
|
|
user_config_root = Pathname.new(Msf::Config.get_config_root)
|
|
|
|
user_database_yaml = user_config_root.join('database.yml')
|
|
|
|
|
|
|
|
# DO check if the path exists as in test environments there may be no config root, in which case the normal
|
|
|
|
# rails location, `config/database.yml`, should contain the database config.
|
|
|
|
if user_database_yaml.exist?
|
|
|
|
config.paths['config/database'] = [user_database_yaml.to_path]
|
|
|
|
end
|
2014-05-12 20:03:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-07-18 16:49:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Silence warnings about this defaulting to true
|
|
|
|
I18n.enforce_available_locales = true
|