-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmanager.ts
More file actions
executable file
·54 lines (48 loc) · 1.35 KB
/
manager.ts
File metadata and controls
executable file
·54 lines (48 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env bun
/** Entry point for the config and process manager */
import { startServer } from "process-pastry";
import { parseArgs } from "util";
import { randomBytes } from "crypto";
import configApp from "./config-ui/index.html";
const { values } = parseArgs({
args: Bun.argv,
options: {
env: {
type: "string",
short: "e",
default: ".env",
},
command: {
type: "string",
short: "c",
},
},
allowPositionals: true,
});
const managerUser = process.env.MANAGER_USER || "admin";
let managerPassword = process.env.MANAGER_PASSWORD;
if (!managerPassword) {
managerPassword = randomBytes(16).toString("hex");
console.log(`\n⚠️ WARNING: No MANAGER_PASSWORD set in environment.`);
console.log(`🔒 Generated temporary password for config manager:`);
console.log(` User: ${managerUser}`);
console.log(` Password: ${managerPassword}\n`);
}
// Start process-pastry server with the bundled HTML
startServer({
port: 3000,
envPath: values.env || ".env",
command: values.command
? values.command.split(" ")
: ["bun", "run", "src/mcp/server.ts"],
authUser: managerUser,
authPassword: managerPassword,
// Expose existing environment variables to the config UI
expose: [
"SERVER_SECRET_KEY",
"DEFAULT_SOURCE_PUBKEY",
"SERVER_RELAYS",
"NOSTR_RELAYS",
],
html: configApp,
});