openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
23 lines (22 loc) • 835 B
JavaScript
import { n as tryProcessCwd } from "./safe-cwd-DOxDm8mD.js";
import { w as resolveStateDir } from "./paths-D2sRr1a_.js";
import { t as loadGlobalRuntimeDotEnvFiles } from "./dotenv-global-BxHOyAmz.js";
import fs from "node:fs";
import path from "node:path";
//#region src/cli/gateway-dispatch-dotenv.ts
/** Load only the env files needed before dispatching a command through the gateway. */
async function loadGatewayDispatchCliDotEnv(opts) {
const quiet = opts?.quiet ?? true;
const cwd = tryProcessCwd();
if (cwd && fs.existsSync(path.join(cwd, ".env"))) {
const { loadCliDotEnv } = await import("./dotenv-Bvm6eLnE.js");
loadCliDotEnv({ quiet });
return;
}
loadGlobalRuntimeDotEnvFiles({
quiet,
stateEnvPath: path.join(resolveStateDir(process.env), ".env")
});
}
//#endregion
export { loadGatewayDispatchCliDotEnv };