Module: Bizside::Configurations::Storage

Included in:
Bizside::Config
Defined in:
lib/bizside/configurations/storage.rb

Instance Method Summary collapse

Instance Method Details

#storageObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bizside/configurations/storage.rb', line 5

def storage
  if @storage.nil?
    configfile = ENV['STORAGE_CONFIG_FILE'] ? ENV['STORAGE_CONFIG_FILE'] : default_configfile

    if File.exist?(configfile)
      config = ERB.new(File.read(configfile), 0, '-').result
      @storage = Bizside::Config.new(YAML.load(config)[Bizside.env])
    else
      @storage = Bizside::Config.new
    end
  end

  @storage
end