Declare typed Convex env and route auth through @code/env/convex

- Register SITE_URL, NATIVE_APP_URL, CONVEX_SITE_URL, FLUE_DB_TOKEN in
  convex.config.ts so the generated server.js exposes a typed env object.
- Rewrite auth.ts to consume @code/env/convex and tighten the
  getCurrentUser handler.
- Refresh the backend README to describe the control-plane role and
  generated-file policy.
This commit is contained in:
-Puter
2026-07-19 17:29:21 +05:30
parent 6de7c3065e
commit e91ca4e6f0
7 changed files with 52 additions and 97 deletions

View File

@@ -12,6 +12,7 @@ import type * as auth from "../auth.js";
import type * as daemonCommands from "../daemonCommands.js";
import type * as daemonRuntime from "../daemonRuntime.js";
import type * as daemons from "../daemons.js";
import type * as fluePersistence from "../fluePersistence.js";
import type * as healthCheck from "../healthCheck.js";
import type * as http from "../http.js";
import type * as privateData from "../privateData.js";
@@ -28,6 +29,7 @@ declare const fullApi: ApiFromModules<{
daemonCommands: typeof daemonCommands;
daemonRuntime: typeof daemonRuntime;
daemons: typeof daemons;
fluePersistence: typeof fluePersistence;
healthCheck: typeof healthCheck;
http: typeof http;
privateData: typeof privateData;

View File

@@ -21,6 +21,15 @@ import {
} from "convex/server";
import type { DataModel } from "./dataModel.js";
/**
* Typesafe environment variables declared in `convex.config.ts`.
*/
type Env = {
readonly FLUE_DB_TOKEN: string;
readonly NATIVE_APP_URL: string | undefined;
readonly SITE_URL: string;
};
/**
* Define a query in this Convex app's public API.
*
@@ -95,6 +104,11 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
*/
export declare const httpAction: HttpActionBuilder;
/**
* Typesafe environment variables declared in `convex.config.ts`.
*/
export declare const env: Env;
/**
* A set of services for use within Convex query functions.
*

View File

@@ -91,3 +91,8 @@ export const internalAction = internalActionGeneric;
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
*/
export const httpAction = httpActionGeneric;
/**
* Typesafe environment variables declared in `convex.config.ts`.
*/
export const env = process.env;