feat: reorganize examples and add signature support to JobBuilder
- Reorganized examples into osiris/, sal/, and utils/ folders - Moved hardcoded scripts to separate .rhai files - Added signature() method to JobBuilder for job signing - Updated OSIRIS context to use block_in_place instead of runtime - Removed runtime field from OsirisContext - Added typed save() methods for Note and Event objects - Updated all examples to use new structure and APIs
This commit is contained in:
@@ -46,6 +46,24 @@ impl SyncRunner {
|
||||
db_config.insert("DB_PATH".into(), db_path.to_string().into());
|
||||
db_config.insert("CALLER_ID".into(), job.caller_id.clone().into());
|
||||
db_config.insert("CONTEXT_ID".into(), job.context_id.clone().into());
|
||||
|
||||
// Extract signatories from job signatures, or fall back to env_vars
|
||||
let signatories: Vec<Dynamic> = if !job.signatures.is_empty() {
|
||||
// Use signatures from the job
|
||||
job.signatures.iter()
|
||||
.map(|sig| Dynamic::from(sig.public_key.clone()))
|
||||
.collect()
|
||||
} else if let Some(sig_json) = job.env_vars.get("SIGNATORIES") {
|
||||
// Fall back to SIGNATORIES from env_vars (for backward compatibility)
|
||||
match serde_json::from_str::<Vec<String>>(sig_json) {
|
||||
Ok(sigs) => sigs.into_iter().map(Dynamic::from).collect(),
|
||||
Err(_) => Vec::new(),
|
||||
}
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
db_config.insert("SIGNATORIES".into(), Dynamic::from(signatories));
|
||||
|
||||
engine.set_default_tag(Dynamic::from(db_config));
|
||||
|
||||
debug!("Sync Runner for Context ID '{}': Evaluating script with Rhai engine (job context set).", job.context_id);
|
||||
|
||||
Reference in New Issue
Block a user