Class: AppHealth::Config
- Inherits:
-
Object
- Object
- AppHealth::Config
- Defined in:
- lib/apphealth/config.rb
Constant Summary collapse
- FILE_NAME =
'.apphealth.yml'
Class Method Summary collapse
- .config ⇒ Object
- .config_file ⇒ Object
- .current_dir_file ⇒ Object
- .default_url ⇒ Object
- .home_dir_file ⇒ Object
- .servers ⇒ Object
Class Method Details
.config ⇒ Object
21 22 23 24 25 |
# File 'lib/apphealth/config.rb', line 21 def self.config raise ConfigNotFound, 'Config file not found' unless self.config_file @config ||= YAML.load_file(self.config_file) end |
.config_file ⇒ Object
17 18 19 |
# File 'lib/apphealth/config.rb', line 17 def self.config_file self.current_dir_file || self.home_dir_file end |
.current_dir_file ⇒ Object
33 34 35 36 37 |
# File 'lib/apphealth/config.rb', line 33 def self.current_dir_file File.open(File.join(__dir__, FILE_NAME), 'r') rescue Errno::ENOENT nil end |
.default_url ⇒ Object
13 14 15 |
# File 'lib/apphealth/config.rb', line 13 def self.default_url self.config['default_url'] end |
.home_dir_file ⇒ Object
27 28 29 30 31 |
# File 'lib/apphealth/config.rb', line 27 def self.home_dir_file File.open(File.join(Dir.home, FILE_NAME), 'r') rescue Errno::ENOENT nil end |
.servers ⇒ Object
9 10 11 |
# File 'lib/apphealth/config.rb', line 9 def self.servers self.config['servers'] end |