mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:41:25 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
import process from "node:process";
|
||||
import type { GatewayLockHandle } from "../infra/gateway-lock.js";
|
||||
|
||||
declare const __CLAWDBOT_VERSION__: string;
|
||||
declare const __OPENCLAW_VERSION__: string | undefined;
|
||||
|
||||
const BUNDLED_VERSION =
|
||||
(typeof __CLAWDBOT_VERSION__ === "string" && __CLAWDBOT_VERSION__) ||
|
||||
process.env.CLAWDBOT_BUNDLED_VERSION ||
|
||||
(typeof __OPENCLAW_VERSION__ === "string" && __OPENCLAW_VERSION__) ||
|
||||
process.env.OPENCLAW_BUNDLED_VERSION ||
|
||||
"0.0.0";
|
||||
|
||||
function argValue(args: string[], flag: string): string | undefined {
|
||||
@@ -26,7 +26,7 @@ type GatewayWsLogStyle = "auto" | "full" | "compact";
|
||||
|
||||
async function main() {
|
||||
if (hasFlag(args, "--version") || hasFlag(args, "-v")) {
|
||||
// Match `moltbot --version` behavior for Swift env/version checks.
|
||||
// Match `openclaw --version` behavior for Swift env/version checks.
|
||||
// Keep output a single line.
|
||||
console.log(BUNDLED_VERSION);
|
||||
process.exit(0);
|
||||
@@ -75,6 +75,7 @@ async function main() {
|
||||
const cfg = loadConfig();
|
||||
const portRaw =
|
||||
argValue(args, "--port") ??
|
||||
process.env.OPENCLAW_GATEWAY_PORT ??
|
||||
process.env.CLAWDBOT_GATEWAY_PORT ??
|
||||
(typeof cfg.gateway?.port === "number" ? String(cfg.gateway.port) : "") ??
|
||||
"18789";
|
||||
@@ -86,6 +87,7 @@ async function main() {
|
||||
|
||||
const bindRaw =
|
||||
argValue(args, "--bind") ??
|
||||
process.env.OPENCLAW_GATEWAY_BIND ??
|
||||
process.env.CLAWDBOT_GATEWAY_BIND ??
|
||||
cfg.gateway?.bind ??
|
||||
"loopback";
|
||||
@@ -103,7 +105,9 @@ async function main() {
|
||||
}
|
||||
|
||||
const token = argValue(args, "--token");
|
||||
if (token) process.env.CLAWDBOT_GATEWAY_TOKEN = token;
|
||||
if (token) {
|
||||
process.env.OPENCLAW_GATEWAY_TOKEN = token;
|
||||
}
|
||||
|
||||
let server: Awaited<ReturnType<typeof startGatewayServer>> | null = null;
|
||||
let lock: GatewayLockHandle | null = null;
|
||||
@@ -211,7 +215,7 @@ async function main() {
|
||||
|
||||
void main().catch((err) => {
|
||||
console.error(
|
||||
"[moltbot] Gateway daemon failed:",
|
||||
"[openclaw] Gateway daemon failed:",
|
||||
err instanceof Error ? (err.stack ?? err.message) : err,
|
||||
);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user