diff --git a/src/main.rs b/src/main.rs index 1451f1a..aeed5ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,17 +14,17 @@ use crate::cmd::{Cmd, Execute}; use crate::error::SilentExit; use crate::config_man::{get_config_path, create_config}; +const POSTHOG_API_KEY: Option<&str> = option_env!("POSTHOG_API_KEY"); + #[tokio::main] pub async fn main() -> ExitCode { // Forcibly disable backtraces. env::remove_var("RUST_LIB_BACKTRACE"); env::remove_var("RUST_BACKTRACE"); - let key = env::var("POSTHOG_API_KEY"); - if key.is_err() { - println!("POSTHOG_API_KEY is not set"); - } else { - println!("POSTHOG_API_KEY is set"); + match POSTHOG_API_KEY { + Some(key) => println!("POSTHOG_API_KEY is set"), + None => eprintln!("Warning: POSTHOG_API_KEY is not set"), } let flag_file = get_config_path().unwrap().with_file_name(".vpm_welcome_shown");