Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
5e1b585a2d
commit
21a13f3444
@ -6,7 +6,7 @@ use tokio::io::AsyncWriteExt;
|
|||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use wasmtime::component::*;
|
use wasmtime::component::*;
|
||||||
use wasmtime::{Config, Engine, Store};
|
use wasmtime::{Config, Engine, Store};
|
||||||
use wasmtime_wasi::{WasiCtx, WasiCtxBuilder, WasiView};
|
use wasmtime_wasi::{DirPerms, FilePerms, WasiCtx, WasiCtxBuilder, WasiView};
|
||||||
|
|
||||||
wasmtime::component::bindgen!({
|
wasmtime::component::bindgen!({
|
||||||
path: "wit/world.wit",
|
path: "wit/world.wit",
|
||||||
@ -144,7 +144,14 @@ struct ServerWasiView {
|
|||||||
impl ServerWasiView {
|
impl ServerWasiView {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
let table = ResourceTable::new();
|
let table = ResourceTable::new();
|
||||||
let ctx = WasiCtxBuilder::new().inherit_stdio().build();
|
|
||||||
|
let ctx = WasiCtxBuilder::new()
|
||||||
|
.inherit_stdio()
|
||||||
|
.inherit_env()
|
||||||
|
.inherit_network()
|
||||||
|
.preopened_dir("/", "/", DirPerms::all(), FilePerms::all())
|
||||||
|
.expect("to be able to open root")
|
||||||
|
.build();
|
||||||
|
|
||||||
Self { table, ctx }
|
Self { table, ctx }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user