agentgate 0.1.3 → 0.1.5
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/package.json +1 -1
- package/src/cli.js +4 -0
- package/src/lib/db.js +7 -4
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -24,6 +24,10 @@ Options:
|
|
|
24
24
|
-p, --port <port> Port to run server on (default: 3050, or PORT env)
|
|
25
25
|
-h, --help Show this help message
|
|
26
26
|
|
|
27
|
+
Environment:
|
|
28
|
+
PORT Server port (default: 3050)
|
|
29
|
+
AGENTGATE_DATA_DIR Data directory (default: ~/.agentgate/)
|
|
30
|
+
|
|
27
31
|
Examples:
|
|
28
32
|
agentgate start
|
|
29
33
|
agentgate start --port 8080
|
package/src/lib/db.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import Database from 'better-sqlite3';
|
|
2
2
|
import { nanoid } from 'nanoid';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { homedir } from 'os';
|
|
5
|
+
import { mkdirSync } from 'fs';
|
|
5
6
|
import bcrypt from 'bcrypt';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
const
|
|
8
|
+
// Data directory: AGENTGATE_DATA_DIR env var, or ~/.agentgate/
|
|
9
|
+
const dataDir = process.env.AGENTGATE_DATA_DIR || join(homedir(), '.agentgate');
|
|
10
|
+
mkdirSync(dataDir, { recursive: true });
|
|
11
|
+
const dbPath = join(dataDir, 'data.db');
|
|
9
12
|
|
|
10
13
|
const db = new Database(dbPath);
|
|
11
14
|
|