Files
zeekay daa1806b5e the cli stops reporting to another company
init_insights_telemetry built its client without naming a host, so the crate's own default
applied -- upstream's ingestion endpoint. With capture_panics on, debug builds have been
sending command telemetry and panic reports there, and production builds take the same path
with a token from CI, so this was never debug-only.

The host is named explicitly now, from the constant the proxy already uses, so there is one
spelling of where our telemetry goes and no path that falls back to someone else's.

The baked-in debug token went with it. It was upstream's own project key for their team 89529,
and shipping another company's credential in our build script was the more embarrassing half.
A debug build now sends nothing at all: the init returns early when no token is set.
2026-08-08 20:09:15 -07:00

33 lines
1.2 KiB
Rust

use std::env;
use std::fs;
use std::path::PathBuf;
const API_CLI_BUNDLE: &str = "lib/insights-api-cli.mjs";
fn write_api_cli_bundle_include() {
let manifest_dir =
PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR is set by cargo"));
let bundle_path = manifest_dir.join(API_CLI_BUNDLE);
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR is set by cargo"));
let out_path = out_dir.join("api_cli_bundle.rs");
println!("cargo:rerun-if-changed={}", bundle_path.display());
let contents = if bundle_path.is_file() {
let bundle_path_literal = format!("{bundle_path:?}");
format!("const EMBEDDED_API_CLI_BUNDLE: Option<&[u8]> = Some(include_bytes!({bundle_path_literal}));\n")
} else {
"const EMBEDDED_API_CLI_BUNDLE: Option<&[u8]> = None;\n".to_string()
};
fs::write(out_path, contents).expect("write embedded API CLI bundle include");
}
pub fn main() {
write_api_cli_bundle_include();
// No token is baked in here. A debug build therefore sends nothing:
// init_insights_telemetry returns early when INSIGHTS_API_TOKEN is unset.
// Production builds get theirs from CI's secrets.
}