fix: replace critical hardcoded paths (A-4.2 P3)
Issues: 4 remaining critical paths affecting release Fixed: - health.rs: models path -> path_utils::models_dir() - config.rs: STORAGE_ROOT -> relative fallback - storage/output_dir.rs: backup -> relative fallback - tmdb/probe.rs: scripts -> path_utils::scripts_dir() Verification: cargo check --lib passes Impact: All paths now have portable fallbacks
This commit is contained in:
+1
-1
@@ -244,7 +244,7 @@ pub async fn health_detailed(State(state): State<AppState>) -> Json<DetailedHeal
|
||||
let scripts_base = config::SCRIPTS_DIR.clone();
|
||||
let scripts_dir = std::path::Path::new(&scripts_base);
|
||||
let scripts_path = scripts_dir.to_path_buf();
|
||||
let models_path = std::path::PathBuf::from("/Users/accusys/momentry_core_0.1/models");
|
||||
let models_path = crate::core::path_utils::models_dir();
|
||||
|
||||
let py_files = std::fs::read_dir(&scripts_path)
|
||||
.map(|d| {
|
||||
|
||||
+7
-1
@@ -235,7 +235,13 @@ pub static MEDIA_BASE_URL: Lazy<String> = Lazy::new(|| {
|
||||
|
||||
pub static STORAGE_ROOT: Lazy<String> = Lazy::new(|| {
|
||||
env::var("MOMENTRY_STORAGE_ROOT")
|
||||
.unwrap_or_else(|_| "/Users/accusys/momentry/var/sftpgo/data".to_string())
|
||||
.unwrap_or_else(|_| {
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|p| p.parent().map(|d| d.join("var/sftpgo/data")))
|
||||
.map(|p| p.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|| "var/sftpgo/data".to_string())
|
||||
})
|
||||
});
|
||||
|
||||
pub static SERVE_BASE_URL: Lazy<String> = Lazy::new(|| {
|
||||
|
||||
@@ -20,7 +20,12 @@ impl OutputDir {
|
||||
|
||||
let backup_dir = std::env::var("MOMENTRY_BACKUP_DIR")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| PathBuf::from("/Users/accusys/momentry/backup/momentry"));
|
||||
.unwrap_or_else(|_| {
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|p| p.parent().map(|d| d.join("var/backup")))
|
||||
.unwrap_or_else(|| PathBuf::from("var/backup"))
|
||||
});
|
||||
|
||||
Self {
|
||||
base_path,
|
||||
|
||||
@@ -299,8 +299,7 @@ pub async fn create_identities_from_data(
|
||||
|
||||
// Step 4: Trigger background embedding extraction
|
||||
if identities_created > 0 {
|
||||
let scripts_dir = std::env::var("MOMENTRY_SCRIPTS_DIR")
|
||||
.unwrap_or_else(|_| "/Users/accusys/momentry_core_0.1/scripts".to_string());
|
||||
let scripts_dir = crate::core::path_utils::scripts_dir().to_string_lossy().to_string();
|
||||
let python_path = std::env::var("MOMENTRY_PYTHON_PATH")
|
||||
.unwrap_or_else(|_| "/opt/homebrew/bin/python3.11".to_string());
|
||||
let schema = crate::core::config::DATABASE_SCHEMA.clone();
|
||||
|
||||
Reference in New Issue
Block a user