Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions frontend/apps/inspector/src/app/layout.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/tailwind.config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions rivetkit-typescript/packages/rivetkit/src/actor/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import {
} from "@/common/router";
import { noopNext } from "@/common/utils";
import { inspectorLogger } from "@/inspector/log";
import { timingSafeEqual } from "@/utils/crypto";
import { getNodeEnv } from "@/utils/env-vars";

import type { RegistryConfig } from "@/registry/config";
import { type GetUpgradeWebSocket, VERSION } from "@/utils";
import { timingSafeEqual } from "@/utils/crypto";
import { isDev } from "@/utils/env-vars";
import { CONN_DRIVER_SYMBOL } from "./conn/mod";
import type { ActorDriver } from "./driver";
import { loggerWithoutContext } from "./log";
Expand Down Expand Up @@ -167,14 +166,16 @@ export function createActorRouter(
if (config.inspector.enabled) {
// Auth middleware for inspector routes
const inspectorAuth = async (c: any): Promise<Response | undefined> => {
if (getNodeEnv() === "development" && !config.inspector.token()) {
if (isDev() && !config.inspector.token()) {
inspectorLogger().warn({
msg: "RIVET_INSPECTOR_TOKEN is not set, skipping inspector auth in development mode",
});
return undefined;
}

const userToken = c.req.header("Authorization")?.replace("Bearer ", "");
const userToken = c.req
.header("Authorization")
?.replace("Bearer ", "");
if (!userToken) {
return c.text("Unauthorized", 401);
}
Expand All @@ -197,7 +198,9 @@ export function createActorRouter(

const actor = await actorDriver.loadActor(c.env.actorId);
const isStateEnabled = actor.inspector.isStateEnabled();
const state = isStateEnabled ? actor.inspector.getStateJson() : undefined;
const state = isStateEnabled
? actor.inspector.getStateJson()
: undefined;
return c.json({ state, isStateEnabled });
});

Expand Down
6 changes: 3 additions & 3 deletions rivetkit-typescript/packages/rivetkit/src/manager/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
import { buildActorNames, type RegistryConfig } from "@/registry/config";
import type { GetUpgradeWebSocket } from "@/utils";
import { timingSafeEqual } from "@/utils/crypto";
import { getNodeEnv } from "@/utils/env-vars";
import { isDev } from "@/utils/env-vars";
import {
buildOpenApiRequestBody,
buildOpenApiResponses,
Expand Down Expand Up @@ -319,13 +319,13 @@ export function buildManagerRouter(
});

router.openapi(route, async (c) => {
if (getNodeEnv() === "development" && !config.token) {
if (isDev() && !config.token) {
logger().warn({
msg: "RIVET_TOKEN is not set, skipping KV store access checks in development mode. This endpoint will be disabled in production, unless you set the token.",
});
}

if (getNodeEnv() !== "development") {
if (!isDev()) {
if (!config.token) {
throw new RestrictedFeature("KV store access");
}
Expand Down
Loading