openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
26 lines (25 loc) • 1.09 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs";
import { r as defaultRuntime } from "./runtime-B-SLYP-m.mjs";
import { t as readSecretFromFile } from "./secret-file-CU0QXmwc.mjs";
//#region src/cli/gateway-secret-options.ts
function resolveGatewaySecretOption(e, t, n) {
const r = normalizeOptionalString(e);
const i = normalizeOptionalString(t);
if (r && i) throw new Error(`Use either --${n} or --${n}-file for Gateway ${n}.`);
return i ? readSecretFromFile(i, `Gateway ${n}`) : r;
}
function warnGatewaySecretCliFlag(e) {
defaultRuntime.error(`Warning: ${e} can be exposed via process listings. Prefer ${e}-file or environment variables.`);
}
function resolveGatewayAuthOptions(e) {
const t = resolveGatewaySecretOption(e.token, e.tokenFile, "token");
const n = resolveGatewaySecretOption(e.password, e.passwordFile, "password");
if (e.token) warnGatewaySecretCliFlag("--token");
if (e.password) warnGatewaySecretCliFlag("--password");
return {
gatewayToken: t,
gatewayPassword: n
};
}
//#endregion
export { resolveGatewayAuthOptions as t };