@13w/miri 1.1.15 → 1.1.16
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/cli.js +13 -9
- package/package.json +14 -14
package/dist/cli.js
CHANGED
|
@@ -56,12 +56,13 @@ program.version(pkg.version);
|
|
|
56
56
|
program.option('-e --env <environment>', 'Environment name from .mirirc', 'default');
|
|
57
57
|
program.option('-m --migrations <folder>', `Folder with migrations (default: "${process.cwd(), join(process.cwd(), 'migrations')}")`);
|
|
58
58
|
program.option('-d --db <mongo-uri>', 'MongoDB Connection URI (default: "mongodb://localhost:27017/test")');
|
|
59
|
+
program.option('--no-direct-connection', 'Disable direct connection', true);
|
|
59
60
|
program.option('--ssh-profile <profile>', 'Connect via SSH using profile');
|
|
60
61
|
program.option('--ssh-host <host>', 'Connect via SSH proxy Host');
|
|
61
62
|
program.option('--ssh-port <port>', 'Connect via SSH proxy Port');
|
|
62
63
|
program.option('--ssh-user <user>', 'Connect via SSH proxy User');
|
|
63
64
|
program.option('--ssh-key <path/to/key>', 'Connect via SSH proxy IdentityKey');
|
|
64
|
-
program.option('--ssh-ask-pass', 'Ask for the private key password'
|
|
65
|
+
program.option('--ssh-ask-pass', 'Ask for the private key password');
|
|
65
66
|
let configCache;
|
|
66
67
|
const getConfig = (programOpts) => {
|
|
67
68
|
if (configCache) {
|
|
@@ -84,18 +85,21 @@ const getConfig = (programOpts) => {
|
|
|
84
85
|
};
|
|
85
86
|
const createSSHTunnel = async (opts) => {
|
|
86
87
|
const config = getConfig(opts);
|
|
87
|
-
|
|
88
|
-
if (config.sshKey && config.sshAskPass) {
|
|
89
|
-
passphrase = await askPassword();
|
|
90
|
-
}
|
|
88
|
+
const passphrase = config.sshKey && config.sshAskPass ? await askPassword() : void 0;
|
|
91
89
|
const sshOptions = {
|
|
92
90
|
host: config.sshHost,
|
|
93
91
|
port: Number(config.sshPort ?? 22),
|
|
94
92
|
username: config.sshUser,
|
|
95
|
-
// agent: SSH_AUTH_SOCK,
|
|
96
|
-
privateKey: config.sshKey ? readFileSync(realpathSync(config.sshKey)) : void 0,
|
|
97
|
-
passphrase,
|
|
98
93
|
};
|
|
94
|
+
if (config.sshKey) {
|
|
95
|
+
sshOptions.privateKey = readFileSync(realpathSync(config.sshKey));
|
|
96
|
+
if (passphrase) {
|
|
97
|
+
sshOptions.passphrase = passphrase;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else if (SSH_AUTH_SOCK) {
|
|
101
|
+
sshOptions.agent = SSH_AUTH_SOCK;
|
|
102
|
+
}
|
|
99
103
|
console.dir([config, sshOptions]);
|
|
100
104
|
const dst = new URL(config.db);
|
|
101
105
|
const forwardOptions = {
|
|
@@ -112,7 +116,7 @@ const getMiri = async () => {
|
|
|
112
116
|
const config = getConfig(program.opts());
|
|
113
117
|
const db = config.sshHost ? await createSSHTunnel(config) : config.db;
|
|
114
118
|
const dbUri = new URL(db);
|
|
115
|
-
dbUri.searchParams.append('directConnection',
|
|
119
|
+
dbUri.searchParams.append('directConnection', String(config.directConnection ?? true));
|
|
116
120
|
dbUri.searchParams.append('appName', `miri+v${pkg.version}`);
|
|
117
121
|
const client = await connection(dbUri.toString());
|
|
118
122
|
return new Miri(client, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@13w/miri",
|
|
3
3
|
"description": "MongoDB patch manager",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "v20"
|
|
@@ -24,15 +24,10 @@
|
|
|
24
24
|
],
|
|
25
25
|
"main": "bin/miri",
|
|
26
26
|
"types": "types/miri.d.ts",
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsc -p tsconfig.json",
|
|
29
|
-
"lint": "eslint src/ --ext .ts --quiet",
|
|
30
|
-
"prepublish": "pnpm run build"
|
|
31
|
-
},
|
|
32
27
|
"dependencies": {
|
|
33
|
-
"@mongosh/service-provider-server": "^2.2.
|
|
34
|
-
"@mongosh/shell-api": "^2.2.
|
|
35
|
-
"@mongosh/shell-evaluator": "^2.2.
|
|
28
|
+
"@mongosh/service-provider-server": "^2.2.15",
|
|
29
|
+
"@mongosh/shell-api": "^2.2.15",
|
|
30
|
+
"@mongosh/shell-evaluator": "^2.2.15",
|
|
36
31
|
"colors": "^1.4.0",
|
|
37
32
|
"commander": "^12.1.0",
|
|
38
33
|
"console-table-printer": "^2.12.1",
|
|
@@ -41,13 +36,18 @@
|
|
|
41
36
|
"tunnel-ssh": "^5.1.2"
|
|
42
37
|
},
|
|
43
38
|
"devDependencies": {
|
|
44
|
-
"@types/node": "^20.14.
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
46
|
-
"@typescript-eslint/parser": "^7.
|
|
39
|
+
"@types/node": "^20.14.15",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
41
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
47
42
|
"eslint": "^8.57.0",
|
|
48
43
|
"eslint-plugin-deprecation": "^2.0.0",
|
|
49
44
|
"ts-node": "^10.9.2",
|
|
50
45
|
"typescript": "^5.5.4"
|
|
51
46
|
},
|
|
52
|
-
"license": "MIT"
|
|
53
|
-
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc -p tsconfig.json",
|
|
50
|
+
"lint": "eslint src/ --ext .ts --quiet",
|
|
51
|
+
"prepublish": "pnpm run build"
|
|
52
|
+
}
|
|
53
|
+
}
|