mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-20 01:11:18 +00:00
fix: Escape API keys in continue.sh JSON configs to prevent injection (#374)
Replace vulnerable heredoc patterns across 27 continue.sh scripts with setup_continue_config() helper that uses json_escape() + upload_config_file() to safely handle API keys containing special characters like quotes or braces. Also fix _save_token_to_config() in shared/common.sh which had the same unescaped heredoc vulnerability for local token storage. Relates to #104 Agent: security-auditor Co-authored-by: A <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9fd35a77b7
commit
81bab47a74
28 changed files with 104 additions and 413 deletions
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${LIGHTSAIL_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${LIGHTSAIL_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${LIGHTSAIL_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${LIGHTSAIL_SERVER_IP}" \
|
||||
"run_server ${LIGHTSAIL_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Lightsail instance setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -34,21 +34,9 @@ fi
|
|||
log_warn "Setting up environment variables..."
|
||||
run_server "${BINARYLANE_SERVER_IP}" "echo 'export OPENROUTER_API_KEY=${OPENROUTER_API_KEY}' >> ~/.bashrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${BINARYLANE_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${BINARYLANE_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${BINARYLANE_SERVER_IP}" \
|
||||
"run_server ${BINARYLANE_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "BinaryLane server setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${CHERRY_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${CHERRY_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${CHERRY_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${CHERRY_SERVER_IP}" \
|
||||
"run_server ${CHERRY_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Cherry Servers setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -40,21 +40,9 @@ export PATH=\"\$HOME/.bun/bin:\$PATH\"
|
|||
export OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
|
||||
ENV_EOF"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${CIVO_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${CIVO_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${CIVO_SERVER_IP}" \
|
||||
"run_server ${CIVO_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Server setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -32,21 +32,7 @@ log_warn "Setting up environment variables..."
|
|||
run_server "printf 'export OPENROUTER_API_KEY=%s\n' '${OPENROUTER_API_KEY}' >> ~/.bashrc"
|
||||
run_server "printf 'export OPENROUTER_API_KEY=%s\n' '${OPENROUTER_API_KEY}' >> ~/.zshrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Sandbox setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${DO_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${DO_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${DO_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${DO_SERVER_IP}" \
|
||||
"run_server ${DO_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "DigitalOcean droplet setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -36,21 +36,7 @@ log_warn "Setting up environment variables..."
|
|||
run_server "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> ~/.bashrc"
|
||||
run_server "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> ~/.zshrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "E2B sandbox setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${EXOSCALE_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${EXOSCALE_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${EXOSCALE_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${EXOSCALE_SERVER_IP}" \
|
||||
"run_server ${EXOSCALE_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Exoscale server setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -32,21 +32,7 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_fly \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Fly.io setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${GCP_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${GCP_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${GCP_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${GCP_SERVER_IP}" \
|
||||
"run_server ${GCP_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "GCP instance setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -41,21 +41,7 @@ log_warn "Setting up environment variables..."
|
|||
run_in_codespace "${CODESPACE_NAME}" "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> ~/.bashrc"
|
||||
run_in_codespace "${CODESPACE_NAME}" "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> ~/.zshrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_in_codespace "${CODESPACE_NAME}" "mkdir -p ~/.continue"
|
||||
run_in_codespace "${CODESPACE_NAME}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Codespace setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${HETZNER_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${HETZNER_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${HETZNER_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${HETZNER_SERVER_IP}" \
|
||||
"run_server ${HETZNER_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Hetzner server setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -54,21 +54,9 @@ inject_env_vars_ssh "${IONOS_SERVER_IP}" upload_file run_server \
|
|||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
# 7. Create Continue config file
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${IONOS_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${IONOS_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${IONOS_SERVER_IP}" \
|
||||
"run_server ${IONOS_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "IONOS server setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${KAMATERA_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${KAMATERA_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${KAMATERA_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${KAMATERA_SERVER_IP}" \
|
||||
"run_server ${KAMATERA_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Kamatera server setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -35,21 +35,7 @@ log_warn "Setting up environment variables..."
|
|||
|
||||
inject_env_vars_koyeb "OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Koyeb service setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -35,21 +35,9 @@ log_warn "Setting up environment variables..."
|
|||
run_server "$LATITUDE_SERVER_IP" "printf '%s\n' 'export OPENROUTER_API_KEY=${OPENROUTER_API_KEY}' >> /root/.bashrc"
|
||||
run_server "$LATITUDE_SERVER_IP" "printf '%s\n' 'export OPENROUTER_API_KEY=${OPENROUTER_API_KEY}' >> /root/.zshrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "$LATITUDE_SERVER_IP" "mkdir -p ~/.continue"
|
||||
run_server "$LATITUDE_SERVER_IP" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${LATITUDE_SERVER_IP}" \
|
||||
"run_server ${LATITUDE_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Latitude.sh setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${LINODE_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${LINODE_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${LINODE_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${LINODE_SERVER_IP}" \
|
||||
"run_server ${LINODE_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Linode setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -35,21 +35,7 @@ log_warn "Setting up environment variables..."
|
|||
run_server "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> ~/.bashrc"
|
||||
run_server "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> ~/.zshrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Modal sandbox setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -35,21 +35,7 @@ log_warn "Setting up environment variables..."
|
|||
|
||||
inject_env_vars_northflank "OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Northflank service setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${OCI_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${OCI_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${OCI_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${OCI_SERVER_IP}" \
|
||||
"run_server ${OCI_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Oracle Cloud instance setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -36,23 +36,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ovh "${OVH_SERVER_IP}" \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_ovh "${OVH_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
|
||||
# Create config.json with OpenRouter settings
|
||||
run_ovh "${OVH_SERVER_IP}" "cat > ~/.continue/config.json << 'EOFCONFIG'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOFCONFIG"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file_ovh ${OVH_SERVER_IP}" \
|
||||
"run_ovh ${OVH_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "OVHcloud instance setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -35,21 +35,7 @@ log_warn "Setting up environment variables..."
|
|||
|
||||
inject_env_vars_railway "OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Railway service setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -35,21 +35,7 @@ log_warn "Setting up environment variables..."
|
|||
|
||||
inject_env_vars_render "OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "mkdir -p ~/.continue"
|
||||
run_server "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" "upload_file" "run_server"
|
||||
|
||||
echo ""
|
||||
log_info "Render service setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -37,21 +37,9 @@ log_warn "Setting up environment variables..."
|
|||
run_server "${SCALEWAY_SERVER_IP}" "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> /root/.bashrc"
|
||||
run_server "${SCALEWAY_SERVER_IP}" "printf 'export OPENROUTER_API_KEY=\"%s\"\n' '${OPENROUTER_API_KEY}' >> /root/.zshrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${SCALEWAY_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${SCALEWAY_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${SCALEWAY_SERVER_IP}" \
|
||||
"run_server ${SCALEWAY_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Scaleway setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -1433,12 +1433,9 @@ _save_token_to_config() {
|
|||
config_dir=$(dirname "${config_file}")
|
||||
mkdir -p "${config_dir}"
|
||||
|
||||
cat > "${config_file}" << EOF
|
||||
{
|
||||
"api_key": "${token}",
|
||||
"token": "${token}"
|
||||
}
|
||||
EOF
|
||||
local escaped_token
|
||||
escaped_token=$(json_escape "${token}")
|
||||
printf '{\n "api_key": %s,\n "token": %s\n}\n' "${escaped_token}" "${escaped_token}" > "${config_file}"
|
||||
chmod 600 "${config_file}"
|
||||
log_info "API token saved to ${config_file}"
|
||||
}
|
||||
|
|
@ -1610,6 +1607,44 @@ setup_openclaw_config() {
|
|||
upload_config_file "${upload_callback}" "${run_callback}" "${openclaw_json}" "~/.openclaw/openclaw.json"
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# Continue configuration setup
|
||||
# ============================================================
|
||||
|
||||
# Setup Continue configuration files (config.json)
|
||||
# This consolidates the config setup pattern used by all continue.sh scripts
|
||||
# Usage: setup_continue_config OPENROUTER_KEY UPLOAD_CALLBACK RUN_CALLBACK
|
||||
#
|
||||
# Arguments:
|
||||
# OPENROUTER_KEY - OpenRouter API key to inject into config
|
||||
# UPLOAD_CALLBACK - Function to upload files: func(local_path, remote_path)
|
||||
# RUN_CALLBACK - Function to run commands: func(command)
|
||||
#
|
||||
# Example (SSH-based clouds):
|
||||
# setup_continue_config "$OPENROUTER_API_KEY" \
|
||||
# "upload_file $SERVER_IP" \
|
||||
# "run_server $SERVER_IP"
|
||||
#
|
||||
# Example (container clouds):
|
||||
# setup_continue_config "$OPENROUTER_API_KEY" \
|
||||
# "upload_file" \
|
||||
# "run_server"
|
||||
setup_continue_config() {
|
||||
local openrouter_key="${1}"
|
||||
local upload_callback="${2}"
|
||||
local run_callback="${3}"
|
||||
|
||||
log_warn "Configuring Continue..."
|
||||
|
||||
# Create ~/.continue directory
|
||||
${run_callback} "mkdir -p ~/.continue"
|
||||
|
||||
# Create config.json with json_escape to prevent injection
|
||||
local continue_json
|
||||
continue_json=$(printf '{\n "models": [\n {\n "title": "OpenRouter",\n "provider": "openrouter",\n "model": "openrouter/auto",\n "apiBase": "https://openrouter.ai/api/v1",\n "apiKey": %s\n }\n ]\n}\n' "$(json_escape "${openrouter_key}")")
|
||||
upload_config_file "${upload_callback}" "${run_callback}" "${continue_json}" "~/.continue/config.json"
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# SSH key registration helpers
|
||||
# ============================================================
|
||||
|
|
|
|||
|
|
@ -35,21 +35,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_sprite "${SPRITE_NAME}" \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_sprite "${SPRITE_NAME}" "mkdir -p ~/.continue"
|
||||
run_sprite "${SPRITE_NAME}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file_sprite ${SPRITE_NAME}" \
|
||||
"run_sprite ${SPRITE_NAME}"
|
||||
|
||||
echo ""
|
||||
log_info "Sprite setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -34,21 +34,9 @@ log_warn "Setting up environment variables..."
|
|||
run_server "$UPCLOUD_SERVER_IP" "printf '%s\n' 'export OPENROUTER_API_KEY=\"${OPENROUTER_API_KEY}\"' >> /root/.bashrc"
|
||||
run_server "$UPCLOUD_SERVER_IP" "printf '%s\n' 'export OPENROUTER_API_KEY=\"${OPENROUTER_API_KEY}\"' >> /root/.zshrc"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "$UPCLOUD_SERVER_IP" "mkdir -p ~/.continue"
|
||||
run_server "$UPCLOUD_SERVER_IP" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${UPCLOUD_SERVER_IP}" \
|
||||
"run_server ${UPCLOUD_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "UpCloud server setup completed successfully!"
|
||||
|
|
|
|||
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${VULTR_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${VULTR_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${VULTR_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${VULTR_SERVER_IP}" \
|
||||
"run_server ${VULTR_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "Vultr instance setup completed successfully!"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue