summaryrefslogtreecommitdiff
path: root/lib/booru/config.rb
blob: 47306a358d210bdf84e950c9c3526af8156b684a (plain)
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
29
30
31
# frozen_string_literal: true
require 'konfig'
require 'core_ext'

module Booru
  class Config < Konfig::Config
    ROOT = Rails.root.join('config', 'booru')
    CONFIG_CATEGORIES = [:aggregation, :avatar, :badges, :footer,
                         :imports, :quick_tag_table, :ratings, :reports,
                         :secrets, :settings, :tag, :wilson, :livefeed].freeze
    attr_accessor *CONFIG_CATEGORIES

    def initialize
      super ROOT, CONFIG_CATEGORIES
    end
  end

  # A global configuration object that contains items such as
  # predefined object mappings. To add a new element, simply
  # create a new YAML file in config/booru and add its name to
  # CONFIG_CATEGORIES.
  #
  # For example, if config/booru/test.yml contains
  #   :hello_world:
  #     - hello
  #     - world
  # then the resulting Hash will be accessible at Booru::CONFIG.test,
  # and will be the following:
  #   { :hello_world => ["hello", "world"] }
  CONFIG = Config.new
end