@truefoundry/trueforge 0.179.0 → 0.179.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/dist/main.js
CHANGED
|
@@ -428,7 +428,8 @@ function optionalNonEmptyEnv(envKey) {
|
|
|
428
428
|
function buildRedisStandaloneUrl(parts) {
|
|
429
429
|
const bareHost = parts.host.startsWith("[") && parts.host.endsWith("]") ? parts.host.slice(1, -1) : parts.host;
|
|
430
430
|
const host2 = isIPv6(bareHost) ? `[${bareHost}]` : bareHost;
|
|
431
|
-
const
|
|
431
|
+
const protocol = parts.tls ? "rediss" : "redis";
|
|
432
|
+
const url = new URL(`${protocol}://${host2}:${String(parts.port)}/${String(parts.database)}`);
|
|
432
433
|
if (parts.username !== void 0) {
|
|
433
434
|
url.username = parts.username;
|
|
434
435
|
}
|
|
@@ -453,6 +454,11 @@ function resolveRedisConnection() {
|
|
|
453
454
|
const username = optionalNonEmptyEnv("REDIS_USERNAME");
|
|
454
455
|
const password = getEnv("REDIS_PASSWORD");
|
|
455
456
|
const passwordOrUndefined = password === void 0 || password === "" ? void 0 : password;
|
|
457
|
+
const tls = parseBoolean({
|
|
458
|
+
envKey: "REDIS_TLS_ENABLED",
|
|
459
|
+
raw: getEnv("REDIS_TLS_ENABLED"),
|
|
460
|
+
defaultValue: false
|
|
461
|
+
});
|
|
456
462
|
if (sentinelEnabled) {
|
|
457
463
|
const nodes = optionalNonEmptyEnv("REDIS_SENTINEL_NODES");
|
|
458
464
|
const masterName = optionalNonEmptyEnv("REDIS_SENTINEL_MASTER_NAME");
|
|
@@ -501,7 +507,8 @@ function resolveRedisConnection() {
|
|
|
501
507
|
port: port2,
|
|
502
508
|
database,
|
|
503
509
|
username,
|
|
504
|
-
password: passwordOrUndefined
|
|
510
|
+
password: passwordOrUndefined,
|
|
511
|
+
tls
|
|
505
512
|
})
|
|
506
513
|
};
|
|
507
514
|
}
|
|
@@ -15006,14 +15013,15 @@ function serverTlsServeOptions(options) {
|
|
|
15006
15013
|
cert: Buffer.from(read(TLS_CERT_FILE)),
|
|
15007
15014
|
ca: Buffer.from(read(TLS_CA_FILE)),
|
|
15008
15015
|
requestCert: true,
|
|
15009
|
-
// Do not reject at handshake so /healthz probes without a cert still connect.
|
|
15016
|
+
// Do not reject at handshake so /healthz probes and /metrics scrapes without a cert still connect.
|
|
15010
15017
|
rejectUnauthorized: false
|
|
15011
15018
|
}
|
|
15012
15019
|
};
|
|
15013
15020
|
}
|
|
15021
|
+
var CLIENT_CERT_EXEMPT_PATHS = /* @__PURE__ */ new Set(["/healthz", "/metrics"]);
|
|
15014
15022
|
function createClientCertificateMiddleware(logger2) {
|
|
15015
15023
|
return async (c, next) => {
|
|
15016
|
-
if (c.req.path
|
|
15024
|
+
if (CLIENT_CERT_EXEMPT_PATHS.has(c.req.path)) {
|
|
15017
15025
|
await next();
|
|
15018
15026
|
return;
|
|
15019
15027
|
}
|
|
@@ -19485,6 +19493,25 @@ function createSettingsRouter(deps) {
|
|
|
19485
19493
|
|
|
19486
19494
|
// src/app.ts
|
|
19487
19495
|
init_config();
|
|
19496
|
+
|
|
19497
|
+
// src/http/prometheus.ts
|
|
19498
|
+
import { prometheus } from "@hono/prometheus";
|
|
19499
|
+
var DURATION_BUCKETS_SECONDS = [0.01, 0.05, 0.1, 0.2, 0.5, 1, 2.5, 5, 10, 30, 60, 120, 300];
|
|
19500
|
+
var requestDuration = {
|
|
19501
|
+
help: "Duration of HTTP requests in seconds",
|
|
19502
|
+
buckets: DURATION_BUCKETS_SECONDS
|
|
19503
|
+
};
|
|
19504
|
+
function createHttpMetrics() {
|
|
19505
|
+
const { printMetrics, registerMetrics } = prometheus({
|
|
19506
|
+
collectDefaultMetrics: true,
|
|
19507
|
+
metricOptions: {
|
|
19508
|
+
requestDuration
|
|
19509
|
+
}
|
|
19510
|
+
});
|
|
19511
|
+
return { middleware: registerMetrics, handler: printMetrics };
|
|
19512
|
+
}
|
|
19513
|
+
|
|
19514
|
+
// src/app.ts
|
|
19488
19515
|
init_schedule();
|
|
19489
19516
|
|
|
19490
19517
|
// src/zodErrorResponse.ts
|
|
@@ -19623,6 +19650,8 @@ function createServerApp(deps) {
|
|
|
19623
19650
|
activeTurns: deps.activeTurns,
|
|
19624
19651
|
turnSkillsResolverStore: deps.turnSkillsResolverStore
|
|
19625
19652
|
};
|
|
19653
|
+
const httpMetrics = createHttpMetrics();
|
|
19654
|
+
app.use("/api/*", httpMetrics.middleware);
|
|
19626
19655
|
if (config_default.ACCESS_LOGS) {
|
|
19627
19656
|
app.use("*", createAccessLogMiddleware(deps.logger));
|
|
19628
19657
|
}
|
|
@@ -19631,6 +19660,7 @@ function createServerApp(deps) {
|
|
|
19631
19660
|
}
|
|
19632
19661
|
app.use("*", createRequestBodyLimitMiddleware(config_default.MAX_REQUEST_BODY_BYTES));
|
|
19633
19662
|
app.get("/healthz", (c) => c.json({ status: "ok", version: PACKAGE_VERSION }));
|
|
19663
|
+
app.get("/metrics", httpMetrics.handler);
|
|
19634
19664
|
app.route(
|
|
19635
19665
|
"/api/v1/auth",
|
|
19636
19666
|
createAuthRouter({
|
|
@@ -20583,7 +20613,7 @@ import { every } from "hono/combine";
|
|
|
20583
20613
|
import { compress } from "hono/compress";
|
|
20584
20614
|
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
20585
20615
|
import path3 from "path";
|
|
20586
|
-
var SERVER_PATH_PREFIXES = ["/api", "/healthz"];
|
|
20616
|
+
var SERVER_PATH_PREFIXES = ["/api", "/healthz", "/metrics"];
|
|
20587
20617
|
var HASHED_ASSET_PREFIX = "/assets/";
|
|
20588
20618
|
var IMMUTABLE_CACHE_CONTROL = "public, max-age=31536000, immutable";
|
|
20589
20619
|
var REVALIDATE_CACHE_CONTROL = "no-cache";
|