Auto-seed device from CLAUDE_REMOTE_SECRET env var
This commit is contained in:
parent
55defdd834
commit
aa50c550b7
2 changed files with 14 additions and 0 deletions
|
|
@ -8,4 +8,6 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- PORT=7200
|
- PORT=7200
|
||||||
- DB_PATH=/app/data/prod/claude-remote.db
|
- DB_PATH=/app/data/prod/claude-remote.db
|
||||||
|
- CLAUDE_REMOTE_SECRET
|
||||||
|
- CLAUDE_REMOTE_DEVICE_NAME
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import type { ServerWebSocket } from "bun";
|
||||||
import { ansiToHtml } from "./ansi";
|
import { ansiToHtml } from "./ansi";
|
||||||
import {
|
import {
|
||||||
appendOutput,
|
appendOutput,
|
||||||
|
createDevice,
|
||||||
createPrompt,
|
createPrompt,
|
||||||
createSession,
|
createSession,
|
||||||
endSession,
|
endSession,
|
||||||
|
|
@ -81,6 +82,17 @@ function broadcastSSE(event: SSEEvent): void {
|
||||||
const port = Number.parseInt(process.env.PORT || "7200", 10);
|
const port = Number.parseInt(process.env.PORT || "7200", 10);
|
||||||
initDb();
|
initDb();
|
||||||
|
|
||||||
|
// Auto-seed device from env if configured
|
||||||
|
const envSecret = process.env.CLAUDE_REMOTE_SECRET;
|
||||||
|
if (envSecret) {
|
||||||
|
const existing = getDeviceBySecret(envSecret);
|
||||||
|
if (!existing) {
|
||||||
|
const name = process.env.CLAUDE_REMOTE_DEVICE_NAME || "default";
|
||||||
|
createDevice(envSecret, name);
|
||||||
|
console.log(`Auto-seeded device: ${name}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
const server = Bun.serve<SessionData>({
|
const server = Bun.serve<SessionData>({
|
||||||
port,
|
port,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue