change context syntax
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use heromodels::db::hero::OurDB;
|
||||
use rhai::{Dynamic, Engine};
|
||||
use rhailib_dsl::flow::register_flow_rhai_modules;
|
||||
use rhai::{Engine, Dynamic};
|
||||
use std::sync::Arc;
|
||||
use std::{fs, path::Path};
|
||||
|
||||
@@ -23,13 +23,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let mut db_config = rhai::Map::new();
|
||||
db_config.insert("DB_PATH".into(), db_path.into());
|
||||
db_config.insert("CALLER_PUBLIC_KEY".into(), CALLER_ID.into());
|
||||
db_config.insert("CIRCLE_PUBLIC_KEY".into(), CALLER_ID.into());
|
||||
db_config.insert("CALLER_ID".into(), CALLER_ID.into());
|
||||
db_config.insert("CONTEXT_ID".into(), CALLER_ID.into());
|
||||
engine.set_default_tag(Dynamic::from(db_config)); // Or pass via CallFnOptions
|
||||
|
||||
// Load and evaluate the Rhai script
|
||||
let manifest_dir = env!("CARGO_MANIFEST_DIR");
|
||||
let script_path = Path::new(manifest_dir).join("examples").join("flow").join("flow.rhai");
|
||||
let script_path = Path::new(manifest_dir)
|
||||
.join("examples")
|
||||
.join("flow")
|
||||
.join("flow.rhai");
|
||||
println!("Script path: {}", script_path.display());
|
||||
let script = fs::read_to_string(&script_path)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user