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:
|
||||
- PORT=7200
|
||||
- DB_PATH=/app/data/prod/claude-remote.db
|
||||
- CLAUDE_REMOTE_SECRET
|
||||
- CLAUDE_REMOTE_DEVICE_NAME
|
||||
restart: unless-stopped
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import type { ServerWebSocket } from "bun";
|
|||
import { ansiToHtml } from "./ansi";
|
||||
import {
|
||||
appendOutput,
|
||||
createDevice,
|
||||
createPrompt,
|
||||
createSession,
|
||||
endSession,
|
||||
|
|
@ -81,6 +82,17 @@ function broadcastSSE(event: SSEEvent): void {
|
|||
const port = Number.parseInt(process.env.PORT || "7200", 10);
|
||||
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
|
||||
const server = Bun.serve<SessionData>({
|
||||
port,
|
||||
|
|
|
|||
Loading…
Reference in a new issue