gateway configs
This commit is contained in:
69
docker/bin/start-gateway.sh
Normal file
69
docker/bin/start-gateway.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
CONFIG_DIR="${HOME:-/home/node}/.openclaw"
|
||||
CONFIG_FILE="${CONFIG_DIR}/openclaw.json"
|
||||
DEFAULT_CONFIG="/opt/openclaw/defaults/openclaw.json"
|
||||
BIND="${OPENCLAW_GATEWAY_BIND:-lan}"
|
||||
TAILSCALE_MODE="${OPENCLAW_TAILSCALE_MODE:-off}"
|
||||
PORT="${OPENCLAW_GATEWAY_PORT:-18789}"
|
||||
|
||||
mkdir -p "${CONFIG_DIR}"
|
||||
|
||||
if [ ! -f "${CONFIG_FILE}" ] && [ -f "${DEFAULT_CONFIG}" ]; then
|
||||
cp "${DEFAULT_CONFIG}" "${CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
if [ ! -f "${CONFIG_FILE}" ]; then
|
||||
printf '{}\n' > "${CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
tmp_file="$(mktemp)"
|
||||
jq \
|
||||
--arg bind "${BIND}" \
|
||||
--arg tailscale_mode "${TAILSCALE_MODE}" \
|
||||
--arg token "${OPENCLAW_GATEWAY_TOKEN:-}" \
|
||||
'
|
||||
.env.OPENCLAW_GATEWAY_TOKEN = "${OPENCLAW_GATEWAY_TOKEN}" |
|
||||
.env.OPENAI_API_KEY = "${OPENAI_API_KEY}" |
|
||||
.gateway.bind = $bind |
|
||||
.gateway.tailscale.mode = $tailscale_mode |
|
||||
.gateway.auth.mode = "token" |
|
||||
.gateway.auth.token = (if $token == "" then (.gateway.auth.token // "${OPENCLAW_GATEWAY_TOKEN}") else $token end) |
|
||||
.gateway.controlUi.allowInsecureAuth = true |
|
||||
.models.providers.openai = {
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
apiKey: "${OPENAI_API_KEY}",
|
||||
auth: "api-key",
|
||||
api: "openai-completions",
|
||||
models: [
|
||||
{
|
||||
id: "gpt-4.1-mini",
|
||||
name: "GPT-4.1 mini",
|
||||
reasoning: false,
|
||||
input: ["text"],
|
||||
cost: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0},
|
||||
contextWindow: 1047576,
|
||||
maxTokens: 32768
|
||||
},
|
||||
{
|
||||
id: "gpt-image-1",
|
||||
name: "GPT Image 1",
|
||||
reasoning: false,
|
||||
input: ["text", "image"],
|
||||
cost: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0},
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096
|
||||
}
|
||||
]
|
||||
} |
|
||||
.agents.defaults.model.fallbacks = ((.agents.defaults.model.fallbacks // []) + ["openai/gpt-4.1-mini"] | unique) |
|
||||
.agents.defaults.models["openai/gpt-4.1-mini"] = {alias: "OpenAI GPT-4.1 mini"}
|
||||
' "${CONFIG_FILE}" > "${tmp_file}"
|
||||
mv "${tmp_file}" "${CONFIG_FILE}"
|
||||
|
||||
if [ "${OPENCLAW_ENABLE_TAILSCALE:-0}" = "1" ] && [ -x /home/node/.local/bin/tailscale-start.sh ]; then
|
||||
/home/node/.local/bin/tailscale-start.sh || true
|
||||
fi
|
||||
|
||||
exec node dist/index.js gateway --bind "${BIND}" --port "${PORT}"
|
||||
Reference in New Issue
Block a user