UNPKG

@arcjet/env

Version:

Arcjet environment detection

88 lines (87 loc) 1.83 kB
/** * Environment. */ export type Env = { [key: string]: unknown; /** * Base URL of Arcjet API. */ ARCJET_BASE_URL?: string | undefined; /** * Environment of Arcjet SDK. */ ARCJET_ENV?: string | undefined; /** * Key for Arcjet API. */ ARCJET_KEY?: string | undefined; /** * Log level of Arcjet SDK. */ ARCJET_LOG_LEVEL?: string | undefined; /** * Name of Fly.io app. */ FLY_APP_NAME?: string | undefined; /** * Vite mode. */ MODE?: string | undefined; /** * Environment of Node.js. */ NODE_ENV?: string | undefined; /** * Render environment variable. */ RENDER?: string | undefined; /** * Vercel environment variable. */ VERCEL?: string | undefined; }; /** * Detect the platform. * * @param environment * Environment. * @returns * Name of platform if found. */ export declare function platform(environment: Env): "fly-io" | "vercel" | "render" | undefined; /** * Check if the environment is development. * * @param environment * Environment. * @returns * Whether the environment is development. */ export declare function isDevelopment(environment: Env): boolean; /** * Get the log level. * * @param environment * Environment. * @returns * Log level. */ export declare function logLevel(environment: Env): "debug" | "info" | "warn" | "error"; /** * Get the base URL of an Arcjet API. * * @param environment * Environment. * @returns * Base URL of Arcjet API. */ export declare function baseUrl(environment: Env): string; /** * Get the key for an Arcjet API. * * @param environment * Environment. * @returns * Key for Arcjet API if found. */ export declare function apiKey(environment: Env): string | undefined;