@pmate/cli 0.49.0 → 0.49.1
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 +12 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21569,7 +21569,7 @@ var ServiceRuntimeRunner = class {
|
|
|
21569
21569
|
writeRemoteConfig(server, content, remotePath) {
|
|
21570
21570
|
return new Promise((resolve, reject) => {
|
|
21571
21571
|
const target = `pmate@${server}`;
|
|
21572
|
-
const child = (0, import_node_child_process15.spawn)("ssh", [target, "sudo", "tee", remotePath], {
|
|
21572
|
+
const child = (0, import_node_child_process15.spawn)("ssh", [...deploySshIdentityArgs(), target, "sudo", "tee", remotePath], {
|
|
21573
21573
|
stdio: ["pipe", "inherit", "inherit"]
|
|
21574
21574
|
});
|
|
21575
21575
|
child.on("error", reject);
|
|
@@ -21584,7 +21584,7 @@ var ServiceRuntimeRunner = class {
|
|
|
21584
21584
|
reloadNginx(server) {
|
|
21585
21585
|
return new Promise((resolve, reject) => {
|
|
21586
21586
|
const target = `pmate@${server}`;
|
|
21587
|
-
const child = (0, import_node_child_process15.spawn)("ssh", [target, "sudo", "nginx", "-s", "reload"], {
|
|
21587
|
+
const child = (0, import_node_child_process15.spawn)("ssh", [...deploySshIdentityArgs(), target, "sudo", "nginx", "-s", "reload"], {
|
|
21588
21588
|
stdio: ["ignore", "inherit", "inherit"]
|
|
21589
21589
|
});
|
|
21590
21590
|
child.on("error", reject);
|
|
@@ -21796,7 +21796,7 @@ var ServiceRuntimeRunner = class {
|
|
|
21796
21796
|
if (server === "local") return this.runCommandWithEnv("bash", ["-c", command], import_node_os15.default.homedir());
|
|
21797
21797
|
return new Promise((resolve, reject) => {
|
|
21798
21798
|
const target = `pmate@${server}`;
|
|
21799
|
-
const child = (0, import_node_child_process15.spawn)("ssh", [target, "bash -ls"], { stdio: ["pipe", "inherit", "inherit"] });
|
|
21799
|
+
const child = (0, import_node_child_process15.spawn)("ssh", [...deploySshIdentityArgs(), target, "bash -ls"], { stdio: ["pipe", "inherit", "inherit"] });
|
|
21800
21800
|
child.stdin.on("error", reject);
|
|
21801
21801
|
child.stdin.end(`${remoteGitAuthorization(command, process.env.PMATE_DEPLOY_GIT_TOKEN)}
|
|
21802
21802
|
`);
|
|
@@ -21857,6 +21857,15 @@ function remoteGitAuthorization(command, token) {
|
|
|
21857
21857
|
const values = { GIT_CONFIG_COUNT: "3", GIT_CONFIG_KEY_0: "url.https://github.com/.insteadOf", GIT_CONFIG_VALUE_0: "git@github.com:", GIT_CONFIG_KEY_1: "url.https://github.com/.insteadOf", GIT_CONFIG_VALUE_1: "git@ramroll:", GIT_CONFIG_KEY_2: "http.https://github.com/.extraHeader", GIT_CONFIG_VALUE_2: header };
|
|
21858
21858
|
return "git() { " + Object.entries(values).map(([key, value]) => key + "=" + shellQuote2(value)).join(" ") + ' command git "$@"; }\n' + command;
|
|
21859
21859
|
}
|
|
21860
|
+
function deploySshIdentityArgs(env = process.env) {
|
|
21861
|
+
const identity = env.PMATE_DEPLOY_SSH_IDENTITY_FILE?.trim();
|
|
21862
|
+
if (!identity) return [];
|
|
21863
|
+
const file = identity.startsWith("~/") ? import_node_path32.default.join(import_node_os15.default.homedir(), identity.slice(2)) : identity;
|
|
21864
|
+
if (!import_node_path32.default.isAbsolute(file) || !(0, import_node_fs27.existsSync)(file) || !(0, import_node_fs27.statSync)(file).isFile()) {
|
|
21865
|
+
throw new Error("PMATE_DEPLOY_SSH_IDENTITY_FILE must reference an existing absolute local file");
|
|
21866
|
+
}
|
|
21867
|
+
return ["-i", file, "-o", "IdentitiesOnly=yes", "-o", "BatchMode=yes"];
|
|
21868
|
+
}
|
|
21860
21869
|
|
|
21861
21870
|
// src/commands/ServiceCommandHandler.ts
|
|
21862
21871
|
init_namespacedRef();
|