feat: trace-level matching, health watcher/worker status, timezone config
This commit is contained in:
+26
-4
@@ -20,8 +20,7 @@ pub fn set_cache_enabled(enabled: bool) {
|
||||
}
|
||||
|
||||
// Switch 1: watcher detects new file → auto-register
|
||||
pub static RUNTIME_WATCHER_AUTO_REGISTER: Lazy<RwLock<bool>> =
|
||||
Lazy::new(|| RwLock::new(false));
|
||||
pub static RUNTIME_WATCHER_AUTO_REGISTER: Lazy<RwLock<bool>> = Lazy::new(|| RwLock::new(false));
|
||||
|
||||
pub fn get_watcher_auto_register() -> bool {
|
||||
*RUNTIME_WATCHER_AUTO_REGISTER.read().unwrap()
|
||||
@@ -33,8 +32,7 @@ pub fn set_watcher_auto_register(enabled: bool) {
|
||||
}
|
||||
|
||||
// Switch 2: register → auto-trigger processing pipeline
|
||||
pub static RUNTIME_AUTO_PIPELINE_ENABLED: Lazy<RwLock<bool>> =
|
||||
Lazy::new(|| RwLock::new(false));
|
||||
pub static RUNTIME_AUTO_PIPELINE_ENABLED: Lazy<RwLock<bool>> = Lazy::new(|| RwLock::new(false));
|
||||
|
||||
pub fn get_auto_pipeline_enabled() -> bool {
|
||||
*RUNTIME_AUTO_PIPELINE_ENABLED.read().unwrap()
|
||||
@@ -107,6 +105,30 @@ pub static REDIS_KEY_PREFIX: Lazy<String> =
|
||||
pub static DATABASE_SCHEMA: Lazy<String> =
|
||||
Lazy::new(|| env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "public".to_string()));
|
||||
|
||||
pub static SYSTEM_TIMEZONE: Lazy<String> = Lazy::new(|| {
|
||||
if let Ok(tz) = env::var("MOMENTRY_TIMEZONE") {
|
||||
if !tz.is_empty() {
|
||||
return tz;
|
||||
}
|
||||
}
|
||||
if let Ok(tz) = env::var("TZ") {
|
||||
if !tz.is_empty() {
|
||||
return tz;
|
||||
}
|
||||
}
|
||||
// macOS: /etc/localtime → /var/db/timezone/zoneinfo/Asia/Taipei
|
||||
// Linux: /etc/localtime → /usr/share/zoneinfo/Asia/Taipei
|
||||
if let Ok(path) = std::fs::read_link("/etc/localtime") {
|
||||
let s = path.to_string_lossy();
|
||||
for prefix in &["/usr/share/zoneinfo/", "/var/db/timezone/zoneinfo/"] {
|
||||
if let Some(tz) = s.strip_prefix(prefix) {
|
||||
return tz.to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
"Asia/Taipei".to_string()
|
||||
});
|
||||
|
||||
pub static MONGODB_DATABASE: Lazy<String> =
|
||||
Lazy::new(|| env::var("MONGODB_DATABASE").unwrap_or_else(|_| "momentry".to_string()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user