Sha256: 9e54a51cfbc0c8f2a69f7f16e226182112716cc798a98bc78e908100f9e36057

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 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.1 lib/egov_utils/settings.rb