belt 0.3.42 → 0.3.44
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/CHANGELOG.md +33 -0
- data/lib/belt/cli/environment_config.rb +13 -1
- data/lib/belt/route_dsl.rb +13 -7
- data/lib/belt/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: 7977614906b8f7154ca9e00597f1eb5744bc00ac6814985cfda98a16687d5992
|
|
4
|
+
data.tar.gz: d60ca2ff84dec2ce5d8b6ee97be3f9ef189fc455881e30b4877a37ae3dafef36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8cf0deed02541a8775b7f4000ba8f5336d09572d6752520bd5191407fd40b97412d5d8c2ee19790b6e8445231be9ffedbd09688c0233b642a96d2ba4494a38c
|
|
7
|
+
data.tar.gz: 025eb3373be5e8c345b29525fd6f81c2e21581b2b044d66dab03482b838e7e491556e6669b099cd128c0b5e5965b29a1ea741761c741b8dee5c489c7f587c34d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.43
|
|
4
|
+
|
|
5
|
+
### Bug Fix
|
|
6
|
+
|
|
7
|
+
- **Fix nested resource member parameter conflicts**: Extends the fix from 0.3.41
|
|
8
|
+
to also cover deeply nested resources and custom member actions. Previously,
|
|
9
|
+
resources nested inside other nested resources (e.g., `epics` inside `projects`
|
|
10
|
+
with a block) still used `{id}` for member routes while custom member actions
|
|
11
|
+
(like `post :test, on: :member`) used `{param_name}`.
|
|
12
|
+
|
|
13
|
+
This fixes the error for routes like:
|
|
14
|
+
```
|
|
15
|
+
/projects/{project_id}/webhooks/{id} # show/update/destroy
|
|
16
|
+
/projects/{project_id}/webhooks/{webhook_id}/test # custom member action
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Now both use consistent parameter names when the resource has a block:
|
|
20
|
+
```
|
|
21
|
+
/projects/{project_id}/webhooks/{webhook_id}
|
|
22
|
+
/projects/{project_id}/webhooks/{webhook_id}/test
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 0.3.42
|
|
26
|
+
|
|
27
|
+
### New Features
|
|
28
|
+
|
|
29
|
+
- **Auto-sync apex DNS records**: When deploying to a production/apex environment,
|
|
30
|
+
`belt deploy` now automatically syncs A alias records (apex, www, api) to the
|
|
31
|
+
root zone in your shared DNS account. No more manual DNS steps for prod deploys.
|
|
32
|
+
|
|
33
|
+
- **`belt dns doctor`**: New diagnostic command showing DNS health across all
|
|
34
|
+
environments — zone status, NS delegation, ACM certificates, and resolution tests.
|
|
35
|
+
|
|
3
36
|
## 0.3.41
|
|
4
37
|
|
|
5
38
|
### Bug Fix
|
|
@@ -41,11 +41,23 @@ module Belt
|
|
|
41
41
|
|
|
42
42
|
# Apply the configured aws_profile and env vars to the current process.
|
|
43
43
|
# Call this before running terraform, aws cli, etc.
|
|
44
|
+
#
|
|
45
|
+
# Note: If AWS credentials are already available via environment variables
|
|
46
|
+
# (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN) — as in GitHub
|
|
47
|
+
# Actions OIDC — we skip setting AWS_PROFILE to avoid overriding valid credentials.
|
|
44
48
|
def apply!
|
|
45
|
-
ENV['AWS_PROFILE'] = @aws_profile if aws_profile?
|
|
49
|
+
ENV['AWS_PROFILE'] = @aws_profile if aws_profile? && !credentials_in_env?
|
|
46
50
|
@env_vars.each { |key, value| ENV[key] = value }
|
|
47
51
|
end
|
|
48
52
|
|
|
53
|
+
# Returns true if AWS credentials are available via environment variables.
|
|
54
|
+
# This happens in CI environments (GitHub Actions OIDC, CodeBuild, etc.)
|
|
55
|
+
def credentials_in_env?
|
|
56
|
+
key = ENV.fetch('AWS_ACCESS_KEY_ID', nil)
|
|
57
|
+
secret = ENV.fetch('AWS_SECRET_ACCESS_KEY', nil)
|
|
58
|
+
!key.to_s.empty? && !secret.to_s.empty?
|
|
59
|
+
end
|
|
60
|
+
|
|
49
61
|
class ConfigEvaluator
|
|
50
62
|
def initialize(config)
|
|
51
63
|
@config = config
|
data/lib/belt/route_dsl.rb
CHANGED
|
@@ -75,8 +75,11 @@ module Belt
|
|
|
75
75
|
resource_options = options.merge(route_type: :resources)
|
|
76
76
|
actions = @gateway.send(:determine_actions, options)
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
# When there's a block (nested resources or custom member actions), use {param_name}
|
|
79
|
+
# for member routes to avoid API Gateway sibling path parameter conflicts.
|
|
80
|
+
has_nested = !block.nil?
|
|
81
|
+
add_nested_resource_routes(resource_name, param_name, resource_options, actions, use_param_name: has_nested)
|
|
82
|
+
return unless has_nested
|
|
80
83
|
|
|
81
84
|
nested_member_prefix = "#{@prefix}/#{resource_name}/{#{param_name}}"
|
|
82
85
|
nested_collection_prefix = "#{@prefix}/#{resource_name}"
|
|
@@ -251,8 +254,11 @@ module Belt
|
|
|
251
254
|
end
|
|
252
255
|
end
|
|
253
256
|
|
|
254
|
-
def add_nested_resource_routes(resource_name,
|
|
255
|
-
# Member routes (show/update/destroy) use {id}
|
|
257
|
+
def add_nested_resource_routes(resource_name, param_name, resource_options, actions, use_param_name: false)
|
|
258
|
+
# Member routes (show/update/destroy) use {id} by default (Rails convention).
|
|
259
|
+
# When nested resources or custom member actions exist (use_param_name: true),
|
|
260
|
+
# use {param_name} instead to avoid API Gateway sibling path parameter conflicts.
|
|
261
|
+
member_param = use_param_name ? param_name : 'id'
|
|
256
262
|
if actions.include?(:index)
|
|
257
263
|
@gateway.send(:add_route, :get, "#{@prefix}/#{resource_name}",
|
|
258
264
|
resolve_request_model_for(resource_options, :index))
|
|
@@ -262,16 +268,16 @@ module Belt
|
|
|
262
268
|
resolve_request_model_for(resource_options, :create))
|
|
263
269
|
end
|
|
264
270
|
if actions.include?(:show)
|
|
265
|
-
@gateway.send(:add_route, :get, "#{@prefix}/#{resource_name}/{
|
|
271
|
+
@gateway.send(:add_route, :get, "#{@prefix}/#{resource_name}/{#{member_param}}",
|
|
266
272
|
resolve_request_model_for(resource_options, :show))
|
|
267
273
|
end
|
|
268
274
|
if actions.include?(:update)
|
|
269
|
-
@gateway.send(:add_route, :put, "#{@prefix}/#{resource_name}/{
|
|
275
|
+
@gateway.send(:add_route, :put, "#{@prefix}/#{resource_name}/{#{member_param}}",
|
|
270
276
|
resolve_request_model_for(resource_options, :update))
|
|
271
277
|
end
|
|
272
278
|
return unless actions.include?(:destroy)
|
|
273
279
|
|
|
274
|
-
@gateway.send(:add_route, :delete, "#{@prefix}/#{resource_name}/{
|
|
280
|
+
@gateway.send(:add_route, :delete, "#{@prefix}/#{resource_name}/{#{member_param}}",
|
|
275
281
|
resolve_request_model_for(resource_options, :destroy))
|
|
276
282
|
end
|
|
277
283
|
|
data/lib/belt/version.rb
CHANGED