mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 16:11:25 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -12,17 +12,27 @@ type AcceptedEnvOption = {
|
||||
};
|
||||
|
||||
function formatEnvValue(value: string, redact?: boolean): string {
|
||||
if (redact) return "<redacted>";
|
||||
if (redact) {
|
||||
return "<redacted>";
|
||||
}
|
||||
const singleLine = value.replace(/\s+/g, " ").trim();
|
||||
if (singleLine.length <= 160) return singleLine;
|
||||
if (singleLine.length <= 160) {
|
||||
return singleLine;
|
||||
}
|
||||
return `${singleLine.slice(0, 160)}…`;
|
||||
}
|
||||
|
||||
export function logAcceptedEnvOption(option: AcceptedEnvOption): void {
|
||||
if (process.env.VITEST || process.env.NODE_ENV === "test") return;
|
||||
if (loggedEnv.has(option.key)) return;
|
||||
if (process.env.VITEST || process.env.NODE_ENV === "test") {
|
||||
return;
|
||||
}
|
||||
if (loggedEnv.has(option.key)) {
|
||||
return;
|
||||
}
|
||||
const rawValue = option.value ?? process.env[option.key];
|
||||
if (!rawValue || !rawValue.trim()) return;
|
||||
if (!rawValue || !rawValue.trim()) {
|
||||
return;
|
||||
}
|
||||
loggedEnv.add(option.key);
|
||||
log.info(`env: ${option.key}=${formatEnvValue(rawValue, option.redact)} (${option.description})`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user