dokku-compose 0.6.11 → 0.6.13
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/index.js +33 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -129,10 +129,13 @@ function createRunner(opts = {}) {
|
|
|
129
129
|
const log = [];
|
|
130
130
|
const controlPath = opts.host ? path.join(os.tmpdir(), `dc-${createHash("sha1").update(opts.host).digest("hex").slice(0, 16)}.sock`) : null;
|
|
131
131
|
const sshControlFlags = controlPath ? ["-o", "ControlMaster=auto", "-o", `ControlPath=${controlPath}`, "-o", "ControlPersist=60"] : [];
|
|
132
|
+
function shellQuote(arg) {
|
|
133
|
+
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
134
|
+
}
|
|
132
135
|
async function execDokku(args) {
|
|
133
136
|
if (opts.host) {
|
|
134
137
|
try {
|
|
135
|
-
const result = await execa("ssh", [...sshControlFlags, `dokku@${opts.host}`, ...args]);
|
|
138
|
+
const result = await execa("ssh", [...sshControlFlags, `dokku@${opts.host}`, "--", ...args.map(shellQuote)]);
|
|
136
139
|
return { stdout: result.stdout, ok: true };
|
|
137
140
|
} catch (e) {
|
|
138
141
|
return { stdout: e.stdout ?? "", ok: false };
|
|
@@ -150,7 +153,7 @@ function createRunner(opts = {}) {
|
|
|
150
153
|
dryRunLog: log,
|
|
151
154
|
async run(...args) {
|
|
152
155
|
if (opts.dryRun) {
|
|
153
|
-
log.push(args.join(" "));
|
|
156
|
+
log.push(args.map((a) => a.includes(" ") ? shellQuote(a) : a).join(" "));
|
|
154
157
|
return;
|
|
155
158
|
}
|
|
156
159
|
await execDokku(args);
|
|
@@ -721,8 +724,34 @@ var Networks = {
|
|
|
721
724
|
};
|
|
722
725
|
var NetworkProps = {
|
|
723
726
|
key: "network",
|
|
724
|
-
|
|
725
|
-
|
|
727
|
+
read: async (ctx, target) => {
|
|
728
|
+
const raw = await ctx.query("network:report", target);
|
|
729
|
+
const report = parseReport(raw, "network");
|
|
730
|
+
const config = {};
|
|
731
|
+
if (report["attach-post-create"]) {
|
|
732
|
+
config.attach_post_create = report["attach-post-create"].split(/\s+/);
|
|
733
|
+
}
|
|
734
|
+
if (report["initial-network"]) config.initial_network = report["initial-network"];
|
|
735
|
+
if (report["bind-all-interfaces"] === "true") config.bind_all_interfaces = true;
|
|
736
|
+
if (report["tld"]) config.tld = report["tld"];
|
|
737
|
+
return config;
|
|
738
|
+
},
|
|
739
|
+
readAll: async (ctx) => {
|
|
740
|
+
const raw = await ctx.query("network:report");
|
|
741
|
+
const bulk = parseBulkReport(raw, "network");
|
|
742
|
+
const result = /* @__PURE__ */ new Map();
|
|
743
|
+
for (const [app, report] of bulk) {
|
|
744
|
+
const config = {};
|
|
745
|
+
if (report["attach-post-create"]) {
|
|
746
|
+
config.attach_post_create = report["attach-post-create"].split(/\s+/);
|
|
747
|
+
}
|
|
748
|
+
if (report["initial-network"]) config.initial_network = report["initial-network"];
|
|
749
|
+
if (report["bind-all-interfaces"] === "true") config.bind_all_interfaces = true;
|
|
750
|
+
if (report["tld"]) config.tld = report["tld"];
|
|
751
|
+
result.set(app, config);
|
|
752
|
+
}
|
|
753
|
+
return result;
|
|
754
|
+
},
|
|
726
755
|
onChange: async (ctx, target, { after }) => {
|
|
727
756
|
if (after.attach_post_create !== void 0 && after.attach_post_create !== false) {
|
|
728
757
|
const nets = Array.isArray(after.attach_post_create) ? after.attach_post_create : [after.attach_post_create];
|