Paul: Check-in [9add5281a0]

Online event coordination and survey application

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Forgot the config singleton in the last commit 🤦
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:9add5281a07b0c2f986ea2a24f1fe3d0f2ce63010fd93427280382e4b57a6d5b
User & Date: milouse 2018-11-15 22:40:17
Context
2018-11-15
22:41
Add first bits of test infrastructure check-in: 6aece84c55 user: milouse tags: trunk
22:40
Forgot the config singleton in the last commit 🤦 check-in: 9add5281a0 user: milouse tags: trunk
22:22
Add a shared config object check-in: 76472a19bf user: milouse tags: trunk
Changes

Added lib/paul_config.rb.

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require 'yaml'

# Wrapper for Paul App configuration
class PaulConfig
  class << self
    def settings
      unless @config
        @env = ENV['APP_ENV'] || 'development'
        load_settings
      end
      @config
    end

    private

    def load_settings
      s = {}
      conf = File.join 'config', 'config.yml'
      s = YAML.load_file(conf).freeze if File.exist? conf
      @config = {}
      @config = s[@env] if s.has_key?(@env)
      @config['environment'] = @env
      @config
    end
  end
end