hooks-ruby 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27cbf50d13a78bab2fb359d40a11a8ffb6998712317a2927c95a1d083cdd3be3
4
- data.tar.gz: b3473918310de8d23aeaf448af5d09b7601f18dce286a18cfcdc0efd78c7548a
3
+ metadata.gz: 60133a1ffe3b89d168e58f606335ce3f23da219251790a331973b5691310b7f9
4
+ data.tar.gz: 158d1d0522c8e8aa55dd014a06a67f6b4922e87a3224adefb173beea78feed27
5
5
  SHA512:
6
- metadata.gz: e8ec9dc8250c234bad0821d62f4876808725d0aa56ac8b62ba03c5789e02b250e11b0c8b8bba581e691033f130d69ef6d57f29ca2d4c29592389457e75107161
7
- data.tar.gz: 0733db6077bfd15c6723cdad92e443a2c4d262f32ab6c30a989dcee12b07223a7d9bfff4a7fcb50950a1c412cb1c1e1a0031382f3d657d799e89da5a1f0d55dd
6
+ metadata.gz: e56464ca7e87dd022060b36bd0678795efbec4ea6c6fd9bf65c7318320a32624dd9e3c3ad21e2838f701be7593766ad34fe1a65bc851c41209e2e4c9fe149f51
7
+ data.tar.gz: b88b05bf7643f248181973c9954a23dde5b61b0d23bec67d364e20756e2f567a355863725ff81d0644dbdb480788ec261e611d25aba84f09725d6a54d59b629c
@@ -32,16 +32,24 @@ module Hooks
32
32
  #
33
33
  # @param config_path [String, Hash] Path to config file or config hash
34
34
  # @return [Hash] Merged configuration
35
+ # @raise [ArgumentError] if config file path is provided but file doesn't exist
36
+ # @raise [RuntimeError] if config file exists but fails to load
35
37
  def self.load(config_path: nil)
36
38
  config = DEFAULT_CONFIG.dup
37
39
  overrides = []
38
40
 
39
41
  # Load from file if path provided
40
- if config_path.is_a?(String) && File.exist?(config_path)
42
+ if config_path.is_a?(String)
43
+ unless File.exist?(config_path)
44
+ raise ArgumentError, "Configuration file not found: #{config_path}"
45
+ end
46
+
41
47
  file_config = load_config_file(config_path)
42
48
  if file_config
43
49
  overrides << "file config"
44
50
  config.merge!(file_config)
51
+ else
52
+ raise RuntimeError, "Failed to load configuration from file: #{config_path}"
45
53
  end
46
54
  end
47
55
 
@@ -127,7 +135,6 @@ module Hooks
127
135
  env_config = {}
128
136
 
129
137
  env_mappings = {
130
- "HOOKS_HANDLER_DIR" => :handler_dir,
131
138
  "HOOKS_HANDLER_PLUGIN_DIR" => :handler_plugin_dir,
132
139
  "HOOKS_AUTH_PLUGIN_DIR" => :auth_plugin_dir,
133
140
  "HOOKS_LIFECYCLE_PLUGIN_DIR" => :lifecycle_plugin_dir,
@@ -12,18 +12,17 @@ module Hooks
12
12
 
13
13
  # Global configuration schema
14
14
  GLOBAL_CONFIG_SCHEMA = Dry::Schema.Params do
15
- optional(:handler_dir).filled(:string) # For backward compatibility
16
- optional(:handler_plugin_dir).filled(:string)
15
+ required(:handler_plugin_dir).filled(:string)
17
16
  optional(:auth_plugin_dir).maybe(:string)
18
17
  optional(:lifecycle_plugin_dir).maybe(:string)
19
18
  optional(:instruments_plugin_dir).maybe(:string)
20
- optional(:log_level).filled(:string, included_in?: %w[debug info warn error])
19
+ required(:log_level).filled(:string, included_in?: %w[debug info warn error])
21
20
  optional(:request_limit).filled(:integer, gt?: 0)
22
21
  optional(:request_timeout).filled(:integer, gt?: 0)
23
- optional(:root_path).filled(:string)
22
+ required(:root_path).filled(:string)
24
23
  optional(:health_path).filled(:string)
25
24
  optional(:version_path).filled(:string)
26
- optional(:environment).filled(:string, included_in?: %w[development production])
25
+ required(:environment).filled(:string, included_in?: %w[development production])
27
26
  optional(:endpoints_dir).filled(:string)
28
27
  optional(:use_catchall_route).filled(:bool)
29
28
  optional(:normalize_headers).filled(:bool)
data/lib/hooks/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  module Hooks
5
5
  # Current version of the Hooks webhook framework
6
6
  # @return [String] The version string following semantic versioning
7
- VERSION = "0.4.0".freeze
7
+ VERSION = "0.5.0".freeze
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hooks-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - github