From 7ba46a06303c80a09968e9e009d5e85c35c38039 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 5 Apr 2023 15:55:44 +0200 Subject: [PATCH] Honor `ZED_RELEASE_CHANNEL` environment variable only in development We don't want people to be able to override the release channel in production. --- crates/util/src/channel.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/util/src/channel.rs b/crates/util/src/channel.rs index 03b0f04271..274fd576a0 100644 --- a/crates/util/src/channel.rs +++ b/crates/util/src/channel.rs @@ -3,8 +3,12 @@ use std::env; use lazy_static::lazy_static; lazy_static! { - pub static ref RELEASE_CHANNEL_NAME: String = env::var("ZED_RELEASE_CHANNEL") - .unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").to_string()); + pub static ref RELEASE_CHANNEL_NAME: String = if cfg!(debug_assertions) { + env::var("ZED_RELEASE_CHANNEL") + .unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").to_string()) + } else { + include_str!("../../zed/RELEASE_CHANNEL").to_string() + }; pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() { "dev" => ReleaseChannel::Dev, "preview" => ReleaseChannel::Preview,