mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 10:01:11 +00:00
fix(cli): apply --profile before dotenv bootstrap in runCli (#31950)
Co-authored-by: bmendonca3 <bmendonca3@users.noreply.github.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import { assertSupportedRuntime } from "../infra/runtime-guard.js";
|
||||
import { installUnhandledRejectionHandler } from "../infra/unhandled-rejections.js";
|
||||
import { enableConsoleCapture } from "../logging.js";
|
||||
import { getCommandPath, getPrimaryCommand, hasHelpOrVersion } from "./argv.js";
|
||||
import { applyCliProfileEnv, parseCliProfileArgs } from "./profile.js";
|
||||
import { tryRouteCli } from "./route.js";
|
||||
import { normalizeWindowsArgv } from "./windows-argv.js";
|
||||
|
||||
@@ -62,7 +63,16 @@ export function shouldEnsureCliPath(argv: string[]): boolean {
|
||||
}
|
||||
|
||||
export async function runCli(argv: string[] = process.argv) {
|
||||
const normalizedArgv = normalizeWindowsArgv(argv);
|
||||
let normalizedArgv = normalizeWindowsArgv(argv);
|
||||
const parsedProfile = parseCliProfileArgs(normalizedArgv);
|
||||
if (!parsedProfile.ok) {
|
||||
throw new Error(parsedProfile.error);
|
||||
}
|
||||
if (parsedProfile.profile) {
|
||||
applyCliProfileEnv({ profile: parsedProfile.profile });
|
||||
}
|
||||
normalizedArgv = parsedProfile.argv;
|
||||
|
||||
loadDotEnv({ quiet: true });
|
||||
normalizeEnv();
|
||||
if (shouldEnsureCliPath(normalizedArgv)) {
|
||||
|
||||
Reference in New Issue
Block a user