Class: Redmine::Configuration

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/redmine/configuration.rb

Overview

Container for library-level configuration, acting like an OpenStruct.

Constant Summary collapse

CONFIG_FILENAME =

Filename of configuration files to look for.

'.redmine.yml'.freeze

Class Method Summary collapse

Class Method Details

.autoloadObject

Load configuration from special YAML config files on disk, looking into the current directory and upwards, merging all together.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/redmine/configuration.rb', line 13

def self.autoload
  new(Pathname
    .pwd
    .ascend
    .lazy
    .map { |p| p.join(CONFIG_FILENAME) }
    .select(&:exist?)
    .map { |p| YAML.load_file(p) }
    .to_a
    .reverse
    .inject(:merge)
     )
end