rb-konfig 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d4f1c0da5f57c267a60744219db12cf6367dbbab95f3565b80fae2b0b4b44bb
4
- data.tar.gz: 7edcd4ef1a08f53bce1fa4df0472ad1f52edb01734af8f0ccbc7d1bac5befbfb
3
+ metadata.gz: 13dc2b950e1107253dbd69374abda84a6bd609695fb28e49676c7d841397b58b
4
+ data.tar.gz: 15ccf9fa2b8be891e77f8bdc7c1dfe6050c4a6c660bd01524ab3693c4bb7e0f8
5
5
  SHA512:
6
- metadata.gz: 7684f9dc14ff341145b701277d8e0a06fc9d11a027b1ab7d9fb707f09654510e6065bd04b25c3da12f6de51ad707b7bbae1357a659779d30d693e64d8943e53d
7
- data.tar.gz: 24e20e5a45290d8351cf4da66b1a51fc8082b630826155db9f594907f08b457b4602e081277a4bed42937425f6074ab18ef382be9e9c23d357636ca5511200d2
6
+ metadata.gz: 6b82d85c862f00fa50caa8102e5668c4ea95154e5997f24972056d52adf55f07d29b73286c1dc134264364f6c40153a3d353c420629174ebd25de69db68570d6
7
+ data.tar.gz: 783ba8be6af7e3c5e3c697dd6c5217c7fba54d9b38cd7a750aafc5db914990464b657130f97c10b350e95f3c3230e28850169ed6a4e17305e2dc5fc78f2aed52
data/README.md CHANGED
@@ -84,6 +84,7 @@ You can change or reach the following from `Konfig.configuration`
84
84
  * `mode`: No default value
85
85
  * `workdir`: No default value
86
86
  * `schema`: Configuration validation schema. If available, the loaded, merged and parsed configuration is validated against this schema. See [Dry-Schema](https://dry-rb.org/gems/dry-schema/) for more information.
87
+ * `fail_on_validation`: Fail if schema validation fails
87
88
 
88
89
  ### Data types
89
90
 
@@ -22,6 +22,7 @@ module Konfig
22
22
  attr_writer :workdir
23
23
  attr_writer :env_prefix
24
24
  attr_writer :logger
25
+ attr_writer :fail_on_validation
25
26
 
26
27
  def namespace
27
28
  @namespace || "Settings"
@@ -82,6 +83,10 @@ module Konfig
82
83
 
83
84
  def nil_word
84
85
  @nil_word || "null"
85
- end
86
+ end
87
+
88
+ def fail_on_validation
89
+ @fail_on_validation.nil? ? true : @fail_on_validation
90
+ end
86
91
  end
87
92
  end
@@ -32,7 +32,11 @@ module Konfig
32
32
 
33
33
  unless v_res.success?
34
34
  error = Konfig::ValidationError.format(v_res)
35
- raise Konfig::ValidationError.new("Config validation failed:\n\n#{error}")
35
+ if Konfig.configuration.fail_on_validation
36
+ raise Konfig::ValidationError.new("Config validation failed:\n\n#{error}")
37
+ else
38
+ Konfig.configuration.logger.error "Config validation failed:\n\n#{error}"
39
+ end
36
40
  end
37
41
  end
38
42
  end
@@ -1,3 +1,3 @@
1
1
  module Konfig
2
- VERSION ||= "0.1.1"
2
+ VERSION ||= "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-konfig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khash Sajadi