2025-06-27 18:14:25 +01:00
|
|
|
use std::{fs, path::Path};
|
|
|
|
|
|
2025-06-14 17:36:54 -04:00
|
|
|
fn main() {
|
2025-07-04 16:24:19 +01:00
|
|
|
dotenv::dotenv().ok();
|
|
|
|
|
|
|
|
|
|
if let Ok(api_key) = std::env::var("POSTHOG_API_KEY") {
|
|
|
|
|
println!("cargo:rustc-env=POSTHOG_API_KEY={}", api_key);
|
|
|
|
|
}
|
|
|
|
|
if let Ok(api_endpoint) = std::env::var("POSTHOG_API_ENDPOINT") {
|
|
|
|
|
println!("cargo:rustc-env=POSTHOG_API_ENDPOINT={}", api_endpoint);
|
|
|
|
|
}
|
2025-07-08 19:32:23 +02:00
|
|
|
if let Ok(api_key) = std::env::var("GITHUB_APP_ID") {
|
|
|
|
|
println!("cargo:rustc-env=GITHUB_APP_ID={}", api_key);
|
|
|
|
|
}
|
|
|
|
|
if let Ok(api_endpoint) = std::env::var("GITHUB_APP_CLIENT_ID") {
|
|
|
|
|
println!("cargo:rustc-env=GITHUB_APP_CLIENT_ID={}", api_endpoint);
|
|
|
|
|
}
|
2025-07-04 16:24:19 +01:00
|
|
|
|
2025-06-27 18:14:25 +01:00
|
|
|
// Create frontend/dist directory if it doesn't exist
|
|
|
|
|
let dist_path = Path::new("../frontend/dist");
|
|
|
|
|
if !dist_path.exists() {
|
|
|
|
|
println!("cargo:warning=Creating dummy frontend/dist directory for compilation");
|
|
|
|
|
fs::create_dir_all(dist_path).unwrap();
|
|
|
|
|
|
|
|
|
|
// Create a dummy index.html
|
|
|
|
|
let dummy_html = r#"<!DOCTYPE html>
|
|
|
|
|
<html><head><title>Build frontend first</title></head>
|
|
|
|
|
<body><h1>Please build the frontend</h1></body></html>"#;
|
|
|
|
|
|
|
|
|
|
fs::write(dist_path.join("index.html"), dummy_html).unwrap();
|
|
|
|
|
}
|
2025-06-14 17:36:54 -04:00
|
|
|
}
|