@launchdarkly/mcp-server
Version:
The local [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for [LaunchDarkly](https://launchdarkly.com/) federal and European Union (EU) environments.
44 lines • 1.12 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { dlv } from "./dlv.js";
export const envSchema = z.object({
LAUNCHDARKLY_API_KEY: z.string().optional(),
LAUNCHDARKLY_DEBUG: z.coerce.boolean().optional(),
});
/**
* Checks for the existence of the Deno global object to determine the environment.
* @returns {boolean} True if the runtime is Deno, false otherwise.
*/
function isDeno() {
if ("Deno" in globalThis) {
return true;
}
return false;
}
let envMemo = undefined;
/**
* Reads and validates environment variables.
*/
export function env() {
if (envMemo) {
return envMemo;
}
let envObject = {};
if (isDeno()) {
envObject = globalThis.Deno?.env?.toObject?.() ?? {};
}
else {
envObject = dlv(globalThis, "process.env") ?? {};
}
envMemo = envSchema.parse(envObject);
return envMemo;
}
/**
* Clears the cached env object. Useful for testing with a fresh environment.
*/
export function resetEnv() {
envMemo = undefined;
}
//# sourceMappingURL=env.js.map