Files
edgeever/apps/api/src/api-context.ts
T
Dariusz Korytoandtianma-if df22f55d1c feat(docker): report image build metadata in System information (#602)
Docker instances reported most deployment fields as unknown. Report how
and when the container image was built, separately from how the
instance was deployed:

- Dockerfile: optional EDGE_EVER_BUILD_CREATED_AT, EDGE_EVER_BUILD_TRIGGER
  and EDGE_EVER_BUILD_METHOD build args, empty by default.
- /api/health (self-hosted-bun only): optional buildCreatedAt and
  buildProvenance. deploymentVersionCreatedAt and deployment keep their
  meaning and stay runtime-supplied; Cloudflare responses are unchanged.
- docker-image.yml: official images record the build time and their
  provenance. Draft-release builds dispatched with release_tag are
  github_release, main pushes main_push, other dispatches manual.
  The container test checks the health response for a metadata build
  with runtime overrides and for a default self-build; the post-publish
  audit checks the published image.
- Add an explicit `docker` deployment method. It is never inferred from
  the runtime, and the registry source still comes only from
  EDGE_EVER_CONTAINER_IMAGE.
- Web/desktop show "Image built at" and "Image build source" for Docker;
  Android shows "Image built at". Older clients ignore the new fields.
- Document the build args and runtime variables in both Docker guides.

Co-authored-by: tianma-if <yingwaizhiying@gmail.com>
2026-10-18 11:43:41 +08:00

71 lines
2.5 KiB
TypeScript

import type { Context } from "hono";
import type { CloudflareStorageBindings } from "./cloudflare-storage-adapter";
import type { StorageAdapter } from "./storage-contract";
export type Bindings = {
/** Runtime driver for public-only egress; no platform-specific business logic. */
publicNetworkFetch?: (input: string, init: RequestInit) => Promise<Response>;
/** The only persistence dependency exposed to application code. */
storage: StorageAdapter;
EDGE_EVER_AUTH_USERNAME?: string;
EDGE_EVER_RUNTIME?: string;
EDGE_EVER_CONTAINER_IMAGE?: string;
EDGE_EVER_DEPLOYMENT_TRIGGER?: string;
EDGE_EVER_DEPLOYMENT_METHOD?: string;
EDGE_EVER_BUILD_CREATED_AT?: string;
EDGE_EVER_BUILD_TRIGGER?: string;
EDGE_EVER_BUILD_METHOD?: string;
/** Creation time of the active deployment version, supplied by a runtime adapter. */
deploymentVersionCreatedAt?: string;
EDGE_EVER_AUTH_PASSWORD?: string;
EDGE_EVER_AUTH_PASSWORD_HASH?: string;
EDGE_EVER_AUTH_PASSWORD_FALLBACK?: string;
EDGE_EVER_SESSION_TTL_DAYS?: string;
EDGE_EVER_AUTH_LOGIN_WINDOW_SECONDS?: string;
EDGE_EVER_AUTH_LOGIN_USERNAME_MAX_ATTEMPTS?: string;
EDGE_EVER_AUTH_LOGIN_USERNAME_COOLDOWN_SECONDS?: string;
EDGE_EVER_AUTH_LOGIN_IP_MAX_ATTEMPTS?: string;
EDGE_EVER_AUTH_LOGIN_IP_COOLDOWN_SECONDS?: string;
EDGE_EVER_R2_BUCKET_NAME?: string;
/** Legacy decryption fallback; new credentials use auth-derived keys. */
EDGE_EVER_STORAGE_ENCRYPTION_KEY?: string;
EDGE_EVER_CREDENTIALS_ENCRYPTION_KEY?: string;
EDGE_EVER_CREDENTIALS_ENCRYPTION_KEY_PREVIOUS?: string;
EDGE_EVER_DEMO_MODE?: string;
EDGE_EVER_LOCAL_DEMO_SEED?: string;
EDGE_EVER_ALLOW_UNAUTHENTICATED?: string;
/** HTTPS URL of the signed community registry. Unset disables the catalog. */
EDGE_EVER_COMMUNITY_REGISTRY_URL?: string;
};
export type WorkerBindings = Omit<Bindings, "storage" | "publicNetworkFetch" | "deploymentVersionCreatedAt"> & CloudflareStorageBindings & {
CF_VERSION_METADATA?: { timestamp?: string };
};
export type AuthContext = {
kind: "user" | "agent";
actorType: "user" | "agent";
actorId: string | null;
username: string;
displayName: string | null;
scopes: string[];
workspaceId: string;
role: "owner" | "member";
sessionId?: string;
tokenId?: string;
};
export type AuditActor = {
actorType: "user" | "agent";
actorId: string | null;
};
export type AppEnv = {
Bindings: Bindings;
Variables: {
auth: AuthContext;
};
};
export type AppContext = Context<AppEnv>;