Fix/prod build (#51)

* chore: add CI secrets management and local testing script

- Added ci-secrets.example.json to provide a template for CI secrets configuration.
- Introduced test-ci-local.sh script to facilitate local testing of the package-and-publish workflow using act.
- Updated .gitignore to exclude the actual ci-secrets.json file containing sensitive tokens.

* chore: enhance local testing and environment loading scripts

- Added scripts to load environment variables from .env and JSON files, improving local development setup.
- Introduced ci-event.json to simulate GitHub event payloads for local CI testing.
- Updated test-ci-local.sh to utilize the new event JSON for better integration with local testing workflows.
- Modified .gitignore to include ci-secrets.local.json for local secret management.

* chore: enhance environment loading and improve V8 memory management

- Updated load-env.sh to conditionally load ci-secrets.local.json and set APPLE_PASSWORD for notarization.
- Introduced a delay in auto-starting skills to prevent memory spikes during initialization.
- Adjusted V8 runtime memory settings to minimize initial heap allocation, reducing the risk of OOM errors.

* chore: update version bump workflow to modify tauri.conf.json

- Changed the version update process to reflect changes in tauri.conf.json instead of Cargo.toml.
- Adjusted the commit message to indicate the inclusion of tauri.conf.json in the version bump process.

* chore: migrate from V8 to QuickJS runtime and update related configurations

- Replaced V8 runtime references with QuickJS throughout the codebase, including updates to initialization and error handling.
- Modified package.json to change the build command for macOS to source environment variables correctly.
- Updated Cargo.toml to remove deno_core dependency and include rquickjs with appropriate features.
- Cleaned up unused V8-related code and comments in the runtime modules.
- Adjusted skill manifest checks to support QuickJS compatibility.

* refactor: implement QuickJS runtime and remove V8 references

- Replaced V8 engine with QuickJS in the runtime module, updating related imports and initialization logic.
- Introduced new `qjs_engine.rs` and `qjs_skill_instance.rs` files to handle QuickJS-specific functionality.
- Removed the deprecated `v8_skill_instance.rs` and associated V8-related code.
- Updated JavaScript bootstrap code to align with QuickJS operations and APIs.
- Adjusted documentation and comments to reflect the transition to QuickJS.

* refactor: update IdbStorage to use parking_lot::Mutex for improved concurrency

- Changed the connection management in IdbStorage from RwLock to parking_lot::Mutex for better performance.
- Updated related methods to reflect the new locking mechanism, enhancing the efficiency of database operations.
- Adjusted the IdbOpenResult struct to include serde::Serialize for potential serialization needs.

* refactor: update QuickJS skill instance and timer management

- Modified memory limit and stack size settings in QjsSkillInstance to be asynchronous, improving performance.
- Cleaned up imports in qjs_ops.rs by removing unused dependencies and enhancing function definitions for clarity.
- Refactored timer management functions for better readability and efficiency, including renaming and restructuring comments.

* chore: update package.json scripts and clean up build.rs

- Added a new script for running the Tauri app with environment variable loading.
- Simplified the macOS development command to use a dedicated build script.
- Removed unnecessary environment variable logging from build.rs to streamline the build process.
- Cleaned up commented-out sections in the GitHub Actions workflow for Android packaging.
This commit is contained in:
Steven Enamakel
2026-02-05 19:29:21 +05:30
committed by GitHub
parent 29d62544d6
commit ceb03fb2bc
32 changed files with 2010 additions and 2985 deletions
-48
View File
@@ -3,8 +3,6 @@
/// This module provides configuration values that can be
/// overridden via environment variables at runtime.
use std::env;
use std::path::PathBuf;
use std::sync::Once;
/// Default backend URL (can be overridden via BACKEND_URL env var)
pub const DEFAULT_BACKEND_URL: &str = "https://api.alphahuman.xyz";
@@ -15,55 +13,9 @@ pub const APP_IDENTIFIER: &str = "com.alphahuman.app";
/// Service name for keychain
pub const KEYCHAIN_SERVICE: &str = "AlphaHuman";
/// Ensure .env is loaded once
static DOTENV_INIT: Once = Once::new();
/// Try to find and load .env file from various locations
fn ensure_dotenv_loaded() {
DOTENV_INIT.call_once(|| {
// Try current directory first (project root when running `tauri dev`)
if dotenvy::dotenv().is_ok() {
log::debug!("[config] Loaded .env from current directory");
return;
}
// Try parent directory (when cwd is src-tauri)
if let Ok(cwd) = env::current_dir() {
let parent_env = cwd.parent().map(|p| p.join(".env"));
if let Some(path) = parent_env {
if path.exists() {
if dotenvy::from_path(&path).is_ok() {
log::debug!("[config] Loaded .env from parent directory: {:?}", path);
return;
}
}
}
}
// Try CARGO_MANIFEST_DIR (available during development builds)
if let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") {
let manifest_path = PathBuf::from(&manifest_dir);
// .env is one level up from src-tauri
let project_root_env = manifest_path.parent().map(|p| p.join(".env"));
if let Some(path) = project_root_env {
if path.exists() {
if dotenvy::from_path(&path).is_ok() {
log::debug!("[config] Loaded .env from project root: {:?}", path);
return;
}
}
}
}
log::debug!("[config] No .env file found, using defaults/environment");
});
}
/// Get the backend URL from environment or use default
/// Checks VITE_BACKEND_URL first, then BACKEND_URL, then defaults
pub fn get_backend_url() -> String {
ensure_dotenv_loaded();
let url = env::var("VITE_BACKEND_URL")
.or_else(|_| env::var("BACKEND_URL"))
.unwrap_or_else(|_| DEFAULT_BACKEND_URL.to_string());