Sha256: f4f0bb5f3fe3f4e6d399914ab1a01751ca9b1f805e4d375b266ef888d29047dd

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

require 'settingslogic'

module EgovUtils

  def self.config_file
    ENV.fetch('EGOVUTILS_CONFIG') { Rails.root.join('config', 'config.yml') }
  end

  class Settings < ::Settingslogic
    source (File.exist?(EgovUtils.config_file) ? EgovUtils.config_file : {})

    # namespace Rails.env

    def allow_internal_accounts?
      true
    end

    def allow_register?
      allow_internal_accounts? && allow_register
    end

    def allow_password_reset?
      allow_internal_accounts? && allow_password_reset
    end

    def mock_resources?
      mock_resources
    end

  end

  Settings['allow_register'] ||= false
  Settings['allow_password_reset'] ||= true

  Settings['redmine'] ||= Settingslogic.new({})
  Settings['redmine']['enabled'] ||= false

  Settings['mock_resources'] ||= Rails.env.production? || Rails.env.test?

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
egov_utils-1.4.0 lib/egov_utils/settings.rb