Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make creating annotations for a command easier #5069

Open
linear bot opened this issue Sep 5, 2024 · 0 comments · May be fixed by #5071
Open

Make creating annotations for a command easier #5069

linear bot opened this issue Sep 5, 2024 · 0 comments · May be fixed by #5071

Comments

@linear
Copy link

linear bot commented Sep 5, 2024

Right now creating a manifest locally requires using toml/ciborium locally.

Eg:

        use wasmer_config::package::{Command, CommandV2, CommandAnnotations, Manifest, Package};
        use wasmer_config::ciborium::Value;

        let package: Package = Package::default();
        let args = Value::Array(vec![Value::Text("-w=/assets/config.toml".to_string()), Value::Text("-g=info".to_string())]);
        let wasi_annotations = Value::Map(vec![(Value::Text("main-args".to_string()), args)]);
        let command = Command::V2(CommandV2 {
            name: "script".to_string(),
            module: ModuleReference::Dependency {
                dependency: "wasmer/static-web-server".to_string(),
                module: "webserver".to_string(),
            },
            runner: "https://webc.org/runner/wasi".to_string(),
            annotations: Some(CommandAnnotations::CBOR(Value::Map(vec![(Value::Text("wasi".to_string()), wasi_annotations)]))),
        });
        let mut manifest = Manifest::builder(package)
            .with_dependency(
                "wasmer/static-web-server",
                VersionReq::parse("1.0.4").unwrap(),
            )
            .with_command(command)
            .build()
            .unwrap();
        manifest.fs.insert("/assets".to_string(), PathBuf::from("/assets"));
        manifest.fs.insert(root.clone(), PathBuf::from(root));

Ideally, annotations should be of type Hashmap<String, AnySerializableValue>, so exposing toml and ciborium is not needed.

@maminrayej maminrayej linked a pull request Sep 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0 participants