@omnixal/openclaw-nats-plugin 0.2.5 → 0.2.6
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/cli/docker-setup.ts +3 -3
- package/cli/setup.ts +0 -6
- package/package.json +1 -1
package/cli/docker-setup.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdirSync, cpSync, writeFileSync, existsSync } from 'node:fs';
|
|
|
2
2
|
import { execFileSync } from 'node:child_process';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
4
|
import { PLUGIN_DIR, DOCKER_DIR, DASHBOARD_DIR, STATE_FILE, type PluginState } from './paths';
|
|
5
|
-
import { generateApiKey, writeEnvVariables } from './env-writer';
|
|
5
|
+
import { generateApiKey, getExistingApiKey, writeEnvVariables } from './env-writer';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Try to copy dashboard dist into a running OpenClaw container's volume.
|
|
@@ -58,8 +58,8 @@ export async function dockerSetup(): Promise<void> {
|
|
|
58
58
|
cpSync(templateDir, DOCKER_DIR, { recursive: true });
|
|
59
59
|
cpSync(sidecarSrc, join(DOCKER_DIR, 'sidecar'), { recursive: true });
|
|
60
60
|
|
|
61
|
-
// 2.
|
|
62
|
-
const apiKey = generateApiKey();
|
|
61
|
+
// 2. Reuse existing API key or generate new one
|
|
62
|
+
const apiKey = getExistingApiKey() ?? generateApiKey();
|
|
63
63
|
writeFileSync(join(DOCKER_DIR, '.env'), `NATS_PLUGIN_API_KEY=${apiKey}\n`);
|
|
64
64
|
|
|
65
65
|
// 3. Build and start
|
package/cli/setup.ts
CHANGED
|
@@ -12,12 +12,6 @@ export function buildDashboard(): void {
|
|
|
12
12
|
const dashboardDir = join(PLUGIN_ROOT, 'dashboard');
|
|
13
13
|
const stableDist = DASHBOARD_DIR; // ~/.openclaw/nats-plugin/dashboard/
|
|
14
14
|
|
|
15
|
-
// Already installed to stable location
|
|
16
|
-
if (existsSync(join(stableDist, 'index.html'))) {
|
|
17
|
-
console.log('Dashboard already built, skipping.');
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
15
|
if (!existsSync(join(dashboardDir, 'package.json'))) {
|
|
22
16
|
console.warn('Warning: dashboard source not found, skipping build.');
|
|
23
17
|
return;
|