@solongate/proxy 0.82.41 → 0.82.43
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/dist/commands/index.js +18 -0
- package/dist/index.js +1509 -1291
- package/dist/self-update.d.ts +7 -0
- package/dist/tui/index.js +930 -919
- package/package.json +1 -1
package/dist/commands/index.js
CHANGED
|
@@ -523,6 +523,8 @@ function flagBool(flags, name) {
|
|
|
523
523
|
// src/commands/policy.ts
|
|
524
524
|
var USAGE = usage("solongate policy", "manage cloud policies", [
|
|
525
525
|
["policy list", "list all policies"],
|
|
526
|
+
["policy create <name>", "create a new empty policy"],
|
|
527
|
+
["policy delete <id>", "delete a policy"],
|
|
526
528
|
["policy show <id>", "show one policy (rules, mode)"],
|
|
527
529
|
["policy allow <id> [--command|--path|--url <val>]", "append an ALLOW rule"],
|
|
528
530
|
["policy deny <id> [--command|--path|--url <val>]", "append a DENY rule"],
|
|
@@ -572,6 +574,22 @@ async function run(argv) {
|
|
|
572
574
|
printRules(p.rules);
|
|
573
575
|
return 0;
|
|
574
576
|
}
|
|
577
|
+
case "create": {
|
|
578
|
+
const name = positionals.slice(1).join(" ").trim();
|
|
579
|
+
if (!name) return err(" Usage: policy create <name>"), 1;
|
|
580
|
+
const res = await api.policies.create({ id: `policy-${Date.now()}`, name, rules: [], mode: "denylist" });
|
|
581
|
+
if (json) return printJson(res), 0;
|
|
582
|
+
err(green(` \u2713 Created "${name}"`) + dim(` (${res.id})`));
|
|
583
|
+
return 0;
|
|
584
|
+
}
|
|
585
|
+
case "delete": {
|
|
586
|
+
const id = positionals[1];
|
|
587
|
+
if (!id) return err(" Usage: policy delete <id>"), 1;
|
|
588
|
+
const res = await api.policies.remove(id);
|
|
589
|
+
if (json) return printJson(res), 0;
|
|
590
|
+
err(green(` \u2713 Deleted ${res.policy_id}`));
|
|
591
|
+
return 0;
|
|
592
|
+
}
|
|
575
593
|
case "allow":
|
|
576
594
|
case "deny": {
|
|
577
595
|
const effect = sub === "allow" ? "ALLOW" : "DENY";
|