diff --git a/aws-lightsail/continue.sh b/aws-lightsail/continue.sh index e7663582..8182831b 100644 --- a/aws-lightsail/continue.sh +++ b/aws-lightsail/continue.sh @@ -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!" diff --git a/binarylane/continue.sh b/binarylane/continue.sh index 1978c2e6..11299e0f 100644 --- a/binarylane/continue.sh +++ b/binarylane/continue.sh @@ -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!" diff --git a/cherry/continue.sh b/cherry/continue.sh index 2bc15093..d34c2a10 100644 --- a/cherry/continue.sh +++ b/cherry/continue.sh @@ -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!" diff --git a/civo/continue.sh b/civo/continue.sh index 6c850b75..b740b03f 100644 --- a/civo/continue.sh +++ b/civo/continue.sh @@ -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!" diff --git a/daytona/continue.sh b/daytona/continue.sh index c8acf4aa..1d2c24d4 100644 --- a/daytona/continue.sh +++ b/daytona/continue.sh @@ -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!" diff --git a/digitalocean/continue.sh b/digitalocean/continue.sh index 714dd6e8..b82f0bca 100644 --- a/digitalocean/continue.sh +++ b/digitalocean/continue.sh @@ -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!" diff --git a/e2b/continue.sh b/e2b/continue.sh index 2f493388..d4a9a2b2 100644 --- a/e2b/continue.sh +++ b/e2b/continue.sh @@ -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!" diff --git a/exoscale/continue.sh b/exoscale/continue.sh index 9cae88d5..5b41b3e3 100644 --- a/exoscale/continue.sh +++ b/exoscale/continue.sh @@ -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!" diff --git a/fly/continue.sh b/fly/continue.sh index e0b2ead9..4e01503f 100644 --- a/fly/continue.sh +++ b/fly/continue.sh @@ -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!" diff --git a/gcp/continue.sh b/gcp/continue.sh index 66342df8..13a0895e 100644 --- a/gcp/continue.sh +++ b/gcp/continue.sh @@ -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!" diff --git a/github-codespaces/continue.sh b/github-codespaces/continue.sh index e1ea6850..c2b7bc00 100644 --- a/github-codespaces/continue.sh +++ b/github-codespaces/continue.sh @@ -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!" diff --git a/hetzner/continue.sh b/hetzner/continue.sh index 3c9d840a..a68b701f 100644 --- a/hetzner/continue.sh +++ b/hetzner/continue.sh @@ -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!" diff --git a/ionos/continue.sh b/ionos/continue.sh index 8da4f736..5b39a907 100644 --- a/ionos/continue.sh +++ b/ionos/continue.sh @@ -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!" diff --git a/kamatera/continue.sh b/kamatera/continue.sh index 57686a60..506f54b0 100644 --- a/kamatera/continue.sh +++ b/kamatera/continue.sh @@ -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!" diff --git a/koyeb/continue.sh b/koyeb/continue.sh index 06ccfc0c..07750444 100644 --- a/koyeb/continue.sh +++ b/koyeb/continue.sh @@ -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!" diff --git a/latitude/continue.sh b/latitude/continue.sh index b474538b..3e4f3817 100644 --- a/latitude/continue.sh +++ b/latitude/continue.sh @@ -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!" diff --git a/linode/continue.sh b/linode/continue.sh index ef6dafa0..3f1a8b68 100644 --- a/linode/continue.sh +++ b/linode/continue.sh @@ -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!" diff --git a/modal/continue.sh b/modal/continue.sh index 417b9e85..01375bc8 100644 --- a/modal/continue.sh +++ b/modal/continue.sh @@ -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!" diff --git a/northflank/continue.sh b/northflank/continue.sh index 98bcb2d2..94d4c653 100644 --- a/northflank/continue.sh +++ b/northflank/continue.sh @@ -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!" diff --git a/oracle/continue.sh b/oracle/continue.sh index de309444..6e3f139d 100644 --- a/oracle/continue.sh +++ b/oracle/continue.sh @@ -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!" diff --git a/ovh/continue.sh b/ovh/continue.sh index ebac48b1..b718a882 100644 --- a/ovh/continue.sh +++ b/ovh/continue.sh @@ -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!" diff --git a/railway/continue.sh b/railway/continue.sh index 3fc5045a..3957f400 100644 --- a/railway/continue.sh +++ b/railway/continue.sh @@ -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!" diff --git a/render/continue.sh b/render/continue.sh index 151e203c..cc6e0e1a 100644 --- a/render/continue.sh +++ b/render/continue.sh @@ -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!" diff --git a/scaleway/continue.sh b/scaleway/continue.sh index 3480abec..f2a15e9b 100644 --- a/scaleway/continue.sh +++ b/scaleway/continue.sh @@ -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!" diff --git a/shared/common.sh b/shared/common.sh index b3e73d5b..1af1c987 100644 --- a/shared/common.sh +++ b/shared/common.sh @@ -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 # ============================================================ diff --git a/sprite/continue.sh b/sprite/continue.sh index 23c9e212..89ee2eb1 100644 --- a/sprite/continue.sh +++ b/sprite/continue.sh @@ -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!" diff --git a/upcloud/continue.sh b/upcloud/continue.sh index 32e20859..3fd05bb6 100644 --- a/upcloud/continue.sh +++ b/upcloud/continue.sh @@ -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!" diff --git a/vultr/continue.sh b/vultr/continue.sh index 81ab7860..097569be 100644 --- a/vultr/continue.sh +++ b/vultr/continue.sh @@ -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!"