Sha256: eaab209477c95ac0eb2d073614c6ea2050449a649ec82d2631fe1056c8baff45

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 Bytes

Contents

require "focuslight"

module Focuslight::Config
  DEFAULT_DATADIR = File.expand_path('data', "#{__dir__}/../..")
  DEFAULT_LOG_PATH = File.expand_path('log/application.log', "#{__dir__}/../..")

  def self.get(name)
    case name
    when :datadir
      ENV.fetch('DATADIR', DEFAULT_DATADIR)
    when :float_support
      ENV.fetch('FLOAT_SUPPORT', false)
    when :dburl
      ENV.fetch('DBURL', 'sqlite://data/gforecast.db')
    when :log_path
      ENV.fetch('LOG_PATH', DEFAULT_LOG_PATH)
    when :log_level
      ENV.fetch('LOG_LEVEL', 'info')
    when :log_shift_age
      ENV.fetch('LOG_SHIFT_AGE', '0')
    when :log_shift_size
      ENV.fetch('LOG_SHIFT_SIZE', '1048576')
    else
      raise ArgumentError, 'unknown configuration keyword'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
focuslight-0.1.4 lib/focuslight/config.rb
focuslight-0.1.3 lib/focuslight/config.rb
focuslight-0.1.2 lib/focuslight/config.rb
focuslight-0.1.1 lib/focuslight/config.rb