ework-daemon 0.4.1 → 0.4.2
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/config.ts +4 -1
- package/src/index.ts +1 -1
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -24,6 +24,7 @@ export const configSchema = z.object({
|
|
|
24
24
|
daemon: z.object({
|
|
25
25
|
port: z.coerce.number().default(3101),
|
|
26
26
|
host: z.string().default("0.0.0.0"),
|
|
27
|
+
endpoint: z.string().default(""),
|
|
27
28
|
}),
|
|
28
29
|
opencode: z.object({
|
|
29
30
|
binary: z.string().default("opencode"),
|
|
@@ -75,7 +76,7 @@ const PRODUCTION_DB_DEFAULT = join(
|
|
|
75
76
|
const TEST_DEFAULTS = {
|
|
76
77
|
gitea: { url: "http://localhost:9999", token: "test-token", webhookSecret: "" },
|
|
77
78
|
bot: { username: "ework-daemon-test", token: "test-bot-token" },
|
|
78
|
-
daemon: { port: 3111, host: "0.0.0.0" },
|
|
79
|
+
daemon: { port: 3111, host: "0.0.0.0", endpoint: "" },
|
|
79
80
|
opencode: { binary: "opencode", baseWorkdir: join(tmpdir(), "ework-daemon-test") },
|
|
80
81
|
work: { capacity: 4, heartbeatMs: 10_000, leaseTtlMs: 60_000 },
|
|
81
82
|
db: { path: join(process.cwd(), "test", "ework-daemon-test.db") },
|
|
@@ -124,6 +125,7 @@ export function loadConfig(): Config {
|
|
|
124
125
|
daemon: {
|
|
125
126
|
port: process.env.DAEMON_PORT ?? TEST_DEFAULTS.daemon.port,
|
|
126
127
|
host: process.env.DAEMON_HOST ?? TEST_DEFAULTS.daemon.host,
|
|
128
|
+
endpoint: process.env.DAEMON_ENDPOINT ?? "",
|
|
127
129
|
},
|
|
128
130
|
opencode: {
|
|
129
131
|
binary: process.env.OPENCODE_BINARY ?? TEST_DEFAULTS.opencode.binary,
|
|
@@ -158,6 +160,7 @@ export function loadConfig(): Config {
|
|
|
158
160
|
daemon: {
|
|
159
161
|
port: process.env.DAEMON_PORT ?? 3101,
|
|
160
162
|
host: process.env.DAEMON_HOST ?? "0.0.0.0",
|
|
163
|
+
endpoint: process.env.DAEMON_ENDPOINT ?? "",
|
|
161
164
|
},
|
|
162
165
|
opencode: {
|
|
163
166
|
binary: process.env.OPENCODE_BINARY ?? "opencode",
|
package/src/index.ts
CHANGED
|
@@ -42,7 +42,7 @@ async function boot() {
|
|
|
42
42
|
// 3. First-boot migration: claim all pre-existing ownerless issues.
|
|
43
43
|
await store.releaseDeadOwners(config.work.leaseTtlMs);
|
|
44
44
|
const displayName = hostname();
|
|
45
|
-
const internalEndpoint = `${config.daemon.host}:${config.daemon.port}`;
|
|
45
|
+
const internalEndpoint = config.daemon.endpoint || `${config.daemon.host}:${config.daemon.port}`;
|
|
46
46
|
const daemonId = await store.registerDaemon(displayName, internalEndpoint, config.work.capacity, config.work.leaseTtlMs);
|
|
47
47
|
const absorbed = await store.absorbSameHostDaemons(daemonId, displayName, internalEndpoint);
|
|
48
48
|
const claimed = await store.claimAllOwnerless(daemonId);
|