Sha256: 84e4e428222cfa3601dc6354b5c43f6a41cc84e219250f784de8befa66625262

Contents?: true

Size: 917 Bytes

Versions: 20

Compression:

Stored size: 917 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

  if !Settings.key?('mock_resources')
    Settings['mock_resources'] = !Rails.env.production?
  end

  Settings['mock_resources'] = true if Rails.env.test?
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha16 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha15 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha14 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha13 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha12 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha11 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha10 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha9 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha8 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha7 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha6 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha5 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha4 lib/egov_utils/settings.rb
egov_utils-1.4.5 lib/egov_utils/settings.rb
egov_utils-1.4.4 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha3 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha2 lib/egov_utils/settings.rb
egov_utils-1.5.0.alpha1 lib/egov_utils/settings.rb
egov_utils-1.4.3 lib/egov_utils/settings.rb
egov_utils-1.4.2 lib/egov_utils/settings.rb