diff --git a/cargo-shuttle/src/config.rs b/cargo-shuttle/src/config.rs index 7d640081b..7e14cd54f 100644 --- a/cargo-shuttle/src/config.rs +++ b/cargo-shuttle/src/config.rs @@ -4,6 +4,7 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, Context, Result}; use serde::{Deserialize, Serialize}; +use shuttle_common::constants::API_URL_BETA; use shuttle_common::{constants::API_URL_DEFAULT, ApiKey}; use tracing::trace; @@ -315,11 +316,13 @@ impl RequestContext { self.api_url = api_url; } - pub fn api_url(&self) -> String { + pub fn api_url(&self, beta: bool) -> String { if let Some(api_url) = self.api_url.clone() { api_url } else if let Some(api_url) = self.global.as_ref().unwrap().api_url() { api_url + } else if beta { + API_URL_BETA.to_string() } else { API_URL_DEFAULT.to_string() } diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 98491121c..f117f4ad2 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -186,7 +186,8 @@ impl Shuttle { | Command::Clean | Command::Project(..) ) { - let client = ShuttleApiClient::new(self.ctx.api_url(), self.ctx.api_key().ok()); + let client = + ShuttleApiClient::new(self.ctx.api_url(self.beta), self.ctx.api_key().ok()); self.client = Some(client); if !args.offline && !self.beta { self.check_api_versions().await?; diff --git a/common/src/constants.rs b/common/src/constants.rs index b44ca7162..80bca396a 100644 --- a/common/src/constants.rs +++ b/common/src/constants.rs @@ -8,6 +8,7 @@ pub const STORAGE_DIRNAME: &str = ".shuttle-storage"; // URLs pub const API_URL_LOCAL: &str = "http://localhost:8001"; pub const API_URL_PRODUCTION: &str = "https://api.shuttle.rs"; +pub const API_URL_BETA: &str = "https://api.internal.shuttle.rs"; #[cfg(debug_assertions)] pub const API_URL_DEFAULT: &str = API_URL_LOCAL; #[cfg(not(debug_assertions))]