@genroc/eval-node 0.0.0-edge.b8f0518 → 0.0.0-edge.d1df786
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/dist/worker.js +6 -1
- package/package.json +1 -1
- package/worker.ts +7 -1
package/dist/worker.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// nothing about the queue, which is what keeps the containment strategy swappable.
|
|
5
5
|
//
|
|
6
6
|
// See README.md for the contract, and specs/external-task-queue.md for the queue itself.
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
7
8
|
import { evaluate } from "./eval.js";
|
|
8
9
|
const SERVER = (process.env.GENROC_SERVER ?? "http://localhost:8448").replace(/\/$/, "");
|
|
9
10
|
const WORKER_ID = process.env.WORKER_ID ?? `evaluator-${process.pid}`;
|
|
@@ -15,7 +16,11 @@ const WORKER_ID = process.env.WORKER_ID ?? `evaluator-${process.pid}`;
|
|
|
15
16
|
// Sent as a header rather than in the URL because Node's fetch REFUSES a URL carrying
|
|
16
17
|
// credentials ("Request cannot be constructed from a URL that includes credentials"), so the
|
|
17
18
|
// basic-auth-in-the-URL trick that works for genctl is not available here.
|
|
18
|
-
|
|
19
|
+
// GENROC_TOKEN_FILE is the mounted-secret shape: a credential in a file rather than an
|
|
20
|
+
// environment variable, so it stays out of `docker inspect` and out of the process environment
|
|
21
|
+
// any child inherits. The inline variable wins when both are set.
|
|
22
|
+
const TOKEN = process.env.GENROC_TOKEN ??
|
|
23
|
+
(process.env.GENROC_TOKEN_FILE ? readFileSync(process.env.GENROC_TOKEN_FILE, "utf8").trim() : "");
|
|
19
24
|
const authHeaders = TOKEN ? { authorization: `Bearer ${TOKEN}` } : {};
|
|
20
25
|
// Concurrency is the worker's to set, and that is the point of pulling: under the old fetch
|
|
21
26
|
// shape genroc decided how many scripts ran at once (--max-concurrent, default 200) and the
|
package/package.json
CHANGED
package/worker.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// See README.md for the contract, and specs/external-task-queue.md for the queue itself.
|
|
7
7
|
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
8
9
|
import { evaluate, type EvalRequest, type FailureKind } from "./eval.ts";
|
|
9
10
|
|
|
10
11
|
const SERVER = (process.env.GENROC_SERVER ?? "http://localhost:8448").replace(/\/$/, "");
|
|
@@ -17,7 +18,12 @@ const WORKER_ID = process.env.WORKER_ID ?? `evaluator-${process.pid}`;
|
|
|
17
18
|
// Sent as a header rather than in the URL because Node's fetch REFUSES a URL carrying
|
|
18
19
|
// credentials ("Request cannot be constructed from a URL that includes credentials"), so the
|
|
19
20
|
// basic-auth-in-the-URL trick that works for genctl is not available here.
|
|
20
|
-
|
|
21
|
+
// GENROC_TOKEN_FILE is the mounted-secret shape: a credential in a file rather than an
|
|
22
|
+
// environment variable, so it stays out of `docker inspect` and out of the process environment
|
|
23
|
+
// any child inherits. The inline variable wins when both are set.
|
|
24
|
+
const TOKEN =
|
|
25
|
+
process.env.GENROC_TOKEN ??
|
|
26
|
+
(process.env.GENROC_TOKEN_FILE ? readFileSync(process.env.GENROC_TOKEN_FILE, "utf8").trim() : "");
|
|
21
27
|
const authHeaders: Record<string, string> = TOKEN ? { authorization: `Bearer ${TOKEN}` } : {};
|
|
22
28
|
// Concurrency is the worker's to set, and that is the point of pulling: under the old fetch
|
|
23
29
|
// shape genroc decided how many scripts ran at once (--max-concurrent, default 200) and the
|