Class: Proteus::Config::ConfigValidator

Inherits:
Validators::BaseValidator show all
Defined in:
lib/proteus/config/config.rb

Instance Method Summary collapse

Methods inherited from Validators::BaseValidator

#initialize

Methods included from Validators::ValidationHelpers

#keys_to_hierarchy

Methods included from Validators::ValidationDSL

#collect, #current_data, #each, #each_key, #ensure_data_type, #ensure_keys, #ensure_presence, #ensure_unique_values, #ensure_uniqueness_across, #ensure_value, #in_case, #init, #peek, #transform_to_paths, #within

Constructor Details

This class inherits a constructor from Proteus::Validators::BaseValidator

Instance Method Details

#validateObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/proteus/config/config.rb', line 18

def validate
  within :contexts do
    ensure_data_type Array
    ensure_uniqueness_across :name

    each do
      ensure_keys :name
      ensure_uniqueness_across :name

      within :environments do
        ensure_uniqueness_across :match

        each do
          ensure_keys :backend
        end
      end
    end
  end

  within :slack_webhooks, optional: true do
    ensure_data_type Array

    each do
      ensure_keys :match, :url
    end
  end

  within :backend do
    each_key do
      ensure_keys :key_prefix, :profile

      within :bucket do
        ensure_keys :name, :region
      end
    end
  end
end