Create preview channel

This commit is contained in:
Max Brunsfeld 2022-10-25 14:24:20 -07:00
parent 88be4fe77e
commit a61f3b715b
9 changed files with 64 additions and 37 deletions

View file

@ -50,6 +50,9 @@ pub use rpc::*;
pub use user::*;
lazy_static! {
pub static ref PREVIEW_CHANNEL: bool = std::env::var("ZED_PREVIEW_CHANNEL")
.map_or(false, |var| !var.is_empty())
|| option_env!("ZED_PREVIEW_CHANNEL").map_or(false, |var| !var.is_empty());
pub static ref ZED_SERVER_URL: String =
std::env::var("ZED_SERVER_URL").unwrap_or_else(|_| "https://zed.dev".to_string());
pub static ref IMPERSONATE_LOGIN: Option<String> = std::env::var("ZED_IMPERSONATE")
@ -988,6 +991,11 @@ impl Client {
match rpc_url.scheme() {
"https" => {
rpc_url.set_scheme("wss").unwrap();
rpc_url.set_query(if *PREVIEW_CHANNEL {
Some("preview=1")
} else {
None
});
let request = request.uri(rpc_url.as_str()).body(())?;
let (stream, _) =
async_tungstenite::async_tls::client_async_tls(request, stream).await?;