Skip to content

Commit 1a61b8d

Browse files
committed
Rename handler_dir to handler_plugin_dir in configuration and update related tests. All refs to the handler dir must be made through handler_plugin_dir going forward to be consistent
1 parent 73cc4ed commit 1a61b8d

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

docs/design.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export HOOKS_ROOT_PATH="/webhooks"
109109
export HOOKS_LOG_LEVEL=info
110110

111111
# Paths
112-
export HOOKS_HANDLER_DIR=./handlers
112+
export HOOKS_HANDLER_PLUGIN_DIR=./handlers
113113
export HOOKS_HEALTH_PATH=/health
114114
export HOOKS_VERSION_PATH=/version
115115

@@ -163,7 +163,7 @@ lib/hooks/
163163
```yaml
164164
# config/endpoints/team1.yaml
165165
path: /team1 # Mounted at <root_path>/team1
166-
handler: Team1Handler # Class in handler_dir
166+
handler: Team1Handler # Class in handler_plugin_dir
167167

168168
# Signature validation
169169
auth:
@@ -181,7 +181,7 @@ opts: # Freeform user-defined options
181181
182182
```yaml
183183
# config/config.yaml
184-
handler_dir: ./handlers # handler class directory
184+
handler_plugin_dir: ./handlers # handler class directory
185185
log_level: info # debug | info | warn | error
186186

187187
# Request handling
@@ -345,7 +345,7 @@ app = Hooks.build(
345345

346346
**Handler & Plugin Discovery:**
347347

348-
* Handler classes are auto-discovered from `handler_dir` using file naming convention
348+
* Handler classes are auto-discovered from `handler_plugin_dir` using file naming convention
349349
* File `team1_handler.rb` → class `Team1Handler`
350350
* Plugin classes are loaded from `plugin_dir` and registered based on class inheritance
351351
* All classes must inherit from appropriate base classes to be recognized

lib/hooks/core/config_loader.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def self.load_env_config
127127
env_config = {}
128128

129129
env_mappings = {
130-
"HOOKS_HANDLER_DIR" => :handler_dir,
131130
"HOOKS_HANDLER_PLUGIN_DIR" => :handler_plugin_dir,
132131
"HOOKS_AUTH_PLUGIN_DIR" => :auth_plugin_dir,
133132
"HOOKS_LIFECYCLE_PLUGIN_DIR" => :lifecycle_plugin_dir,

lib/hooks/core/config_validator.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class ValidationError < StandardError; end
1212

1313
# Global configuration schema
1414
GLOBAL_CONFIG_SCHEMA = Dry::Schema.Params do
15-
optional(:handler_dir).filled(:string) # For backward compatibility
1615
optional(:handler_plugin_dir).filled(:string)
1716
optional(:auth_plugin_dir).maybe(:string)
1817
optional(:lifecycle_plugin_dir).maybe(:string)

spec/unit/lib/hooks/core/config_validator_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
context "with valid configuration" do
66
it "returns validated configuration with all optional fields" do
77
config = {
8-
handler_dir: "./custom_handlers",
8+
handler_plugin_dir: "./custom_handlers",
99
log_level: "debug",
1010
request_limit: 2_048_000,
1111
request_timeout: 45,
@@ -101,7 +101,7 @@
101101

102102
it "raises ValidationError for empty string values" do
103103
config = {
104-
handler_dir: "",
104+
handler_plugin_dir: "",
105105
root_path: "",
106106
health_path: ""
107107
}
@@ -125,7 +125,7 @@
125125

126126
it "raises ValidationError for non-string paths" do
127127
config = {
128-
handler_dir: 123,
128+
handler_plugin_dir: 123,
129129
root_path: [],
130130
endpoints_dir: {}
131131
}

0 commit comments

Comments
 (0)