Sha256: 2c4359e61291e0e713d2ec7045710042630e9b324b983a3e0727de5d9ee59805

Contents?: true

Size: 819 Bytes

Versions: 30

Compression:

Stored size: 819 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.exists?(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?

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
egov_utils-1.3.0 lib/egov_utils/settings.rb
egov_utils-1.2.4 lib/egov_utils/settings.rb
egov_utils-1.2.3 lib/egov_utils/settings.rb
egov_utils-1.2.2 lib/egov_utils/settings.rb
egov_utils-1.2.1 lib/egov_utils/settings.rb
egov_utils-1.2.0 lib/egov_utils/settings.rb
egov_utils-1.1.1 lib/egov_utils/settings.rb
egov_utils-1.1.0 lib/egov_utils/settings.rb
egov_utils-1.0.3 lib/egov_utils/settings.rb
egov_utils-1.0.2 lib/egov_utils/settings.rb
egov_utils-1.0.1 lib/egov_utils/settings.rb
egov_utils-1.0.0 lib/egov_utils/settings.rb
egov_utils-0.7.5 lib/egov_utils/settings.rb
egov_utils-0.7.4 lib/egov_utils/settings.rb
egov_utils-0.7.3 lib/egov_utils/settings.rb
egov_utils-0.7.2 lib/egov_utils/settings.rb
egov_utils-0.7.1 lib/egov_utils/settings.rb
egov_utils-0.7.0 lib/egov_utils/settings.rb
egov_utils-0.6.5 lib/egov_utils/settings.rb
egov_utils-0.6.4 lib/egov_utils/settings.rb