@supacloud/cli 0.9.1 → 0.10.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.
- package/README.md +4 -1
- package/dist/index.js +25 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ Task event commands:
|
|
|
98
98
|
|
|
99
99
|
Gateway / Caddy commands (require admin privileges; config is injected via the Caddy JSON Admin API):
|
|
100
100
|
|
|
101
|
-
- `gateway routes` — list custom gateway routes (reverse_proxy / static sites)
|
|
101
|
+
- `gateway routes` — list custom gateway routes (reverse_proxy / static sites / redirects)
|
|
102
102
|
- `gateway upsert_route` — create or replace a route
|
|
103
103
|
- `gateway update_route` — replace a route by id
|
|
104
104
|
- `gateway delete_route` — remove a route by id
|
|
@@ -117,6 +117,9 @@ Gateway / Caddy commands (require admin privileges; config is injected via the C
|
|
|
117
117
|
supacloud-cli gateway routes --ref abc123
|
|
118
118
|
supacloud-cli gateway upsert_route --ref abc123 --route_id webhook \
|
|
119
119
|
--hosts "api.example.com" --paths "/webhook/*" --upstream 10.0.0.5:8080
|
|
120
|
+
supacloud-cli gateway upsert_route --ref abc123 --route_id canonical-https \
|
|
121
|
+
--hosts "www.example.com" --paths "/*" --protocol http \
|
|
122
|
+
--redirect_to 'https://www.example.com{http.request.uri}' --redirect_status 308
|
|
120
123
|
supacloud-cli gateway config --ref abc123 --rate_limit_tier pro
|
|
121
124
|
supacloud-cli gateway rebuild --ref abc123 --clean
|
|
122
125
|
```
|
package/dist/index.js
CHANGED
|
@@ -16693,6 +16693,12 @@ var headersRecord = exports_external.preprocess((value) => {
|
|
|
16693
16693
|
}
|
|
16694
16694
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
16695
16695
|
}, exports_external.record(exports_external.string(), exports_external.string()).optional());
|
|
16696
|
+
var redirectStatus = exports_external.union([
|
|
16697
|
+
exports_external.literal(301),
|
|
16698
|
+
exports_external.literal(302),
|
|
16699
|
+
exports_external.literal(307),
|
|
16700
|
+
exports_external.literal(308)
|
|
16701
|
+
]).optional();
|
|
16696
16702
|
var ok2 = (res) => res.ok ? JSON.stringify(res.data, null, 2) : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
|
|
16697
16703
|
var simple = (res, msg) => res.ok ? `✅ ${msg}` : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
|
|
16698
16704
|
function registerGatewayTools(server, http, options = {}) {
|
|
@@ -16721,7 +16727,10 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
16721
16727
|
paths: stringArray.describe("[upsert_route/update_route] 路径列表,逗号分隔或 JSON 数组(1-20)"),
|
|
16722
16728
|
upstream: exports_external.string().optional().describe("[upsert_route/update_route] 反代上游 host:port 或 http(s)://host[:port]"),
|
|
16723
16729
|
upstream_tls_insecure_skip_verify: exports_external.boolean().optional().describe("[upsert_route/update_route] 上游 TLS 跳过校验"),
|
|
16724
|
-
static_root: exports_external.string().optional().describe("[upsert_route/update_route]
|
|
16730
|
+
static_root: exports_external.string().optional().describe("[upsert_route/update_route] 静态站点根目录"),
|
|
16731
|
+
protocol: exports_external.enum(["http", "https"]).optional().describe("[upsert_route/update_route] 可选请求协议匹配"),
|
|
16732
|
+
redirect_to: exports_external.string().optional().describe("[upsert_route/update_route] 带固定 host 的绝对 http(s) 目标,可在末尾使用 {http.request.uri}"),
|
|
16733
|
+
redirect_status: redirectStatus.describe("[upsert_route/update_route] 重定向状态码,默认 308"),
|
|
16725
16734
|
rewrite_uri: exports_external.string().optional().describe("[upsert_route/update_route] 重写 URI(以 / 开头)"),
|
|
16726
16735
|
strip_prefix: exports_external.string().optional().describe("[upsert_route/update_route] 去除前缀"),
|
|
16727
16736
|
headers: headersRecord.describe("[upsert_route/update_route] 自定义请求头,JSON 或 K:V,K2:V2"),
|
|
@@ -16764,6 +16773,9 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
16764
16773
|
upstream,
|
|
16765
16774
|
upstream_tls_insecure_skip_verify,
|
|
16766
16775
|
static_root,
|
|
16776
|
+
protocol,
|
|
16777
|
+
redirect_to,
|
|
16778
|
+
redirect_status,
|
|
16767
16779
|
rewrite_uri,
|
|
16768
16780
|
strip_prefix,
|
|
16769
16781
|
headers,
|
|
@@ -16808,6 +16820,12 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
16808
16820
|
body.upstream_tls_insecure_skip_verify = upstream_tls_insecure_skip_verify;
|
|
16809
16821
|
if (static_root !== undefined)
|
|
16810
16822
|
body.static_root = static_root;
|
|
16823
|
+
if (protocol !== undefined)
|
|
16824
|
+
body.protocol = protocol;
|
|
16825
|
+
if (redirect_to !== undefined)
|
|
16826
|
+
body.redirect_to = redirect_to;
|
|
16827
|
+
if (redirect_status !== undefined)
|
|
16828
|
+
body.redirect_status = redirect_status;
|
|
16811
16829
|
if (rewrite_uri !== undefined)
|
|
16812
16830
|
body.rewrite_uri = rewrite_uri;
|
|
16813
16831
|
if (strip_prefix !== undefined)
|
|
@@ -16837,6 +16855,12 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
16837
16855
|
body.upstream_tls_insecure_skip_verify = upstream_tls_insecure_skip_verify;
|
|
16838
16856
|
if (static_root !== undefined)
|
|
16839
16857
|
body.static_root = static_root;
|
|
16858
|
+
if (protocol !== undefined)
|
|
16859
|
+
body.protocol = protocol;
|
|
16860
|
+
if (redirect_to !== undefined)
|
|
16861
|
+
body.redirect_to = redirect_to;
|
|
16862
|
+
if (redirect_status !== undefined)
|
|
16863
|
+
body.redirect_status = redirect_status;
|
|
16840
16864
|
if (rewrite_uri !== undefined)
|
|
16841
16865
|
body.rewrite_uri = rewrite_uri;
|
|
16842
16866
|
if (strip_prefix !== undefined)
|