aptunnel 1.1.0 → 1.1.2
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 +1 -1
- package/package.json +1 -1
- package/src/commands/config.js +2 -2
- package/src/commands/init.js +5 -6
- package/src/commands/tunnel.js +1 -1
- package/src/lib/config-manager.js +7 -6
package/README.md
CHANGED
|
@@ -155,7 +155,7 @@ dev ekaredb-redis dev-redis 55555 DOWN - - -
|
|
|
155
155
|
```bash
|
|
156
156
|
aptunnel login # uses saved credentials, supports 2FA
|
|
157
157
|
aptunnel login --email=x@y.com --password=secret
|
|
158
|
-
aptunnel login --lifetime=
|
|
158
|
+
aptunnel login --lifetime=7d # custom token lifetime (max: 7d)
|
|
159
159
|
aptunnel login --status # show token info only
|
|
160
160
|
```
|
|
161
161
|
|
package/package.json
CHANGED
package/src/commands/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export async function runConfig(args) {
|
|
|
26
26
|
if (setPortArg !== -1) {
|
|
27
27
|
const alias = args[setPortArg + 1];
|
|
28
28
|
const port = parseInt(args[setPortArg + 2], 10);
|
|
29
|
-
if (!alias || isNaN(port)) {
|
|
30
|
-
logger.error('Usage: aptunnel config --set-port <alias> <port>');
|
|
29
|
+
if (!alias || isNaN(port) || port < 1 || port > 65535) {
|
|
30
|
+
logger.error('Usage: aptunnel config --set-port <alias> <port> (port must be 1–65535)');
|
|
31
31
|
process.exit(1);
|
|
32
32
|
}
|
|
33
33
|
setPort(alias, port);
|
package/src/commands/init.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import readline from 'readline';
|
|
2
1
|
import { createInterface } from 'readline';
|
|
3
2
|
import { logger } from '../lib/logger.js';
|
|
4
3
|
import { isInstalled, login, listEnvironments, listDatabases } from '../lib/aptible.js';
|
|
5
|
-
import { installInstructions
|
|
4
|
+
import { installInstructions } from '../lib/platform.js';
|
|
6
5
|
import {
|
|
7
6
|
exists, save, savePassword, getConfigDir, getConfigPath, nextAvailablePort,
|
|
8
7
|
} from '../lib/config-manager.js';
|
|
@@ -50,9 +49,9 @@ export async function runInit(args) {
|
|
|
50
49
|
console.log('');
|
|
51
50
|
|
|
52
51
|
// 5. Discover environments
|
|
53
|
-
|
|
52
|
+
process.stdout.write('Discovering environments…\n');
|
|
54
53
|
const environments = listEnvironments();
|
|
55
|
-
|
|
54
|
+
logger.success(`Found ${environments.length} environment(s).`);
|
|
56
55
|
|
|
57
56
|
if (environments.length === 0) {
|
|
58
57
|
logger.warn('No environments found for this account.');
|
|
@@ -109,9 +108,9 @@ export async function runInit(args) {
|
|
|
109
108
|
|
|
110
109
|
for (const env of selectedEnvs) {
|
|
111
110
|
console.log('');
|
|
112
|
-
|
|
111
|
+
process.stdout.write(`Fetching databases for ${env.handle}…\n`);
|
|
113
112
|
const databases = listDatabases(env.handle);
|
|
114
|
-
|
|
113
|
+
logger.success(`Found ${databases.length} database(s) in ${env.handle}.`);
|
|
115
114
|
|
|
116
115
|
if (databases.length === 0) continue;
|
|
117
116
|
|
package/src/commands/tunnel.js
CHANGED
|
@@ -226,7 +226,7 @@ function printConnectionInfo(alias, port, conn) {
|
|
|
226
226
|
logger.detail('Port:', String(conn.port ?? port));
|
|
227
227
|
logger.detail('Host:', conn.host ?? 'localhost.aptible.in');
|
|
228
228
|
logger.detail('User:', conn.user ?? 'aptible');
|
|
229
|
-
logger.detail('Password:', conn.password ? chalk.dim(conn.password) : chalk.dim('(not parsed)'));
|
|
229
|
+
logger.detail('Password:', conn.password ? chalk.dim('*'.repeat(Math.min(conn.password.length, 12))) : chalk.dim('(not parsed)'));
|
|
230
230
|
logger.detail('URL:', conn.url ? chalk.cyan(conn.url) : chalk.dim('(not parsed)'));
|
|
231
231
|
logger.detail('PID:', String(readPid(toIdentifier(alias)) ?? '?'));
|
|
232
232
|
console.log('');
|
|
@@ -81,13 +81,14 @@ export function savePassword(password) {
|
|
|
81
81
|
|
|
82
82
|
if (platform() === 'win32') {
|
|
83
83
|
// On Windows chmod doesn't restrict access — use icacls
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
const username = process.env.USERNAME ?? process.env.USER ?? '';
|
|
85
|
+
if (username) {
|
|
86
|
+
const r = spawnSync('icacls', [credsPath, '/inheritance:r', '/grant:r', `${username}:(R,W)`], { encoding: 'utf8' });
|
|
87
|
+
if (r.status !== 0) {
|
|
88
|
+
process.stderr.write(`[aptunnel] Warning: could not restrict permissions on credentials file: ${credsPath}\n`);
|
|
88
89
|
}
|
|
89
|
-
}
|
|
90
|
-
|
|
90
|
+
} else {
|
|
91
|
+
process.stderr.write(`[aptunnel] Warning: could not determine current user — credentials file may not be permission-restricted.\n`);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
}
|