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 +4 -4
- data/lib/hooks/core/config_loader.rb +9 -2
- data/lib/hooks/core/config_validator.rb +4 -5
- data/lib/hooks/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60133a1ffe3b89d168e58f606335ce3f23da219251790a331973b5691310b7f9
|
4
|
+
data.tar.gz: 158d1d0522c8e8aa55dd014a06a67f6b4922e87a3224adefb173beea78feed27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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
|
-
|
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
|
-
|
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
|
-
|
22
|
+
required(:root_path).filled(:string)
|
24
23
|
optional(:health_path).filled(:string)
|
25
24
|
optional(:version_path).filled(:string)
|
26
|
-
|
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