-
Notifications
You must be signed in to change notification settings - Fork 3
compile and run conductor as WASM (for CloudFlare Worker) #134
Conversation
|
🤯🚀 |
|
🐋 This PR was built and pushed to the following Docker images: Docker Bake metadata{
"conductor": {
"containerimage.config.digest": "sha256:1623f20618b9a20217ad543fe688dcda3829e5661f96250b0f68721c6c7e10d8",
"containerimage.descriptor": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:054c99f2a11a63680f062d7d7e2c78e985033fc616c05adb5db09231d7a407d0",
"size": 901,
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
"containerimage.digest": "sha256:054c99f2a11a63680f062d7d7e2c78e985033fc616c05adb5db09231d7a407d0",
"image.name": "ghcr.io/the-guild-org/conductor-t2/conductor:2583ec5ff7069f370ce7c3b87564f90532c9c0e3"
}
} |
| let conductor_config_str = env.var("CONDUCTOR_CONFIG").map(|v| v.to_string()); | ||
|
|
||
| match conductor_config_str { | ||
| Ok(conductor_config_str) => match from_yaml(&conductor_config_str) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is gonna a bit inefficient to load and parse the config file on every request,
what can we do to maintain this sort of state in a cloudflare function where the function is just stateless? 🤔
| let gw = ConductorGateway::lazy(conductor_config); | ||
|
|
||
| if let Some(route_data) = gw.match_route(&req.url().unwrap()) { | ||
| console_log!("Route found: {:?}", route_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if console_log! macro is handling logging efficiently in production,
It comes from worker_sys by cloudflare workers, and the inline docs are:
When debugging your Worker via wrangler dev, wrangler tail, or from the Workers Dashboard,
anything passed to this macro will be printed to the terminal or written to the console.
|
|
||
| let body = req.bytes().await.unwrap().into(); | ||
| let uri = req.url().unwrap().to_string(); | ||
| let query_string = req.url().unwrap().query().unwrap_or_default().to_string(); | ||
| let method = Method::from_str(req.method().as_ref()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can provide helpful error messages later on instead of .expect()
YassinEldeeb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! ❤️
…a HTTP server, and also CF Worker (wasm) runtime (#127) * restructure ok separated config now wip wip wip ok ok ok it's working again ok getting there ok bring back plugins fix graphiql fix graphiql again fix tracing ok ok ok fix clippy, fmt, over-http and ci fix benches fix deps fix docker image fix * compile and run conductor as WASM (for CloudFlare Worker) (#134)
Related #98
tokiodependencyreqwest/ other client