Skip to content

Commit

Permalink
chore: additional trace logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Jul 26, 2024
1 parent 394c78b commit 451d28c
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 64 deletions.
5 changes: 4 additions & 1 deletion drivers/rust/driver/src/wasm_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use pact_models::prelude::v4::V4Pact;
use pact_models::v4::interaction::V4Interaction;
use serde_json::Value;
use tracing::{debug, info, trace};
use wasmtime::{AsContextMut, Engine, Module, Store};
use wasmtime::{AsContextMut, Config, Engine, Module, Store};
use wasmtime::component::{bindgen, Component, Instance, Linker, ResourceTable};
use wasmtime_wasi::{WasiCtx, WasiCtxBuilder, WasiView};

Expand Down Expand Up @@ -385,15 +385,18 @@ pub fn load_wasm_plugin(manifest: &PactPluginManifest) -> anyhow::Result<WasmPlu
debug!("Loading plugin component from path {:?}", &path);
let component = Component::from_file(&engine, path)?;

trace!("Configuring WASM linker");
let mut linker = Linker::new(&engine);
wasmtime_wasi::add_to_linker_sync(&mut linker)?;
Plugin::add_to_linker(&mut linker, |state: &mut PluginState| state)?;

trace!("Configuring WASM store");
let mut store = Store::new(&engine, PluginState {
table: Default::default(),
ctx: WasiCtxBuilder::new().build(),
plugin_name: format!("{}/{}", manifest.name, manifest.version),
});
trace!("Instantiating plugin instance");
let instance = Plugin::instantiate(&mut store, &component, &linker)?;

let plugin = WasmPlugin {
Expand Down
114 changes: 52 additions & 62 deletions examples/jwt/consumer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/jwt/consumer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ceBsAZahv7NEeMe2Py5yrHZoNWxbf64EJXxzLCbtfBLSGvduzUoQDZqXC9Jh
let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();
let claims = Claims {
aud: "1234566778".to_string(),
exp: now,
exp: now + 5,
iss: "ldsdkdalds".to_string(),
sub: "slksjkdjkdks".to_string(),
.. Claims::default()
Expand Down
Binary file modified plugins/jwt/wasm-plugin/jwt_plugin.wasm
Binary file not shown.

0 comments on commit 451d28c

Please sign in to comment.