-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbf349f
commit ce597c5
Showing
27 changed files
with
542 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
export const meta = { | ||
title: 'COUCOU' | ||
} | ||
|
||
|
||
# Write your first plugin | ||
|
||
## Prerequisites | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Configure your configuration file | ||
|
||
``` | ||
wasmo config get | ||
wasmo config reset | ||
wasmo config set <key>=<value> | ||
``` | ||
Note: This command is unaware of workspaces. | ||
|
||
## Description | ||
|
||
wasmo gets its config from the command line, environment variables, `.wasmo` files, and in some cases, directly from the build command. | ||
|
||
The `wasmo config` command can be used to update and edit the contents of the user and global wasmo files. | ||
|
||
## Sub-commands | ||
|
||
### set | ||
|
||
``` | ||
wasmo config set <key>=<value> | ||
``` | ||
|
||
Sets each of the config keys to the value provided. | ||
|
||
If value is omitted, then it sets it to an empty string. | ||
|
||
The available keys are: | ||
- `path`: configure the path where the wasmo configuration will be stored | ||
- `server`: the Wasmo server to build your plugins (an URL format value is expected) | ||
- `token`: the token, pass to the Wasmo server, to authenticate the CLI | ||
- `docker_authorization`: the token value accepted by Docker instances | ||
|
||
You can also edit the configuration file manually. In this case, the following values are : | ||
- `path` = WASMO_PATH | ||
- `server` = WASMO_SERVER | ||
- `token` = WASMO_TOKEN | ||
- `docker_authorization` = DOCKER_AUTHORIZATION | ||
|
||
### get | ||
|
||
``` | ||
wasmo config get | ||
``` | ||
|
||
Show all the config settings. | ||
|
||
|
||
### reset | ||
|
||
``` | ||
wasmo config get | ||
``` | ||
|
||
Reset the configuration file with the default settings. The custom user `.wasmo` files will not be deleted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use client" | ||
|
||
import Layout from '@/components/Layout'; | ||
import Page from './_page.mdx'; | ||
|
||
export default function Home() { | ||
|
||
return <Layout | ||
metadata={{ | ||
title: 'CLI - Configuration file', | ||
href: '/cli/configuration-file' | ||
}} | ||
previous={{ | ||
href: "/cli/core-commands", | ||
title: "Wasmo - Core commands" | ||
}} | ||
next={{ | ||
href: "/integrations/otoroshi", | ||
title: "Integration - Otoroshi" | ||
}}> | ||
<Page /> | ||
</Layout> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Badges from '../../../components/Badges' | ||
|
||
# Core commands | ||
|
||
The `wasmo` CLI internally contains a number of subcommands for working | ||
with wasm modules: | ||
|
||
## wasmo config set <Badges values={['token', 'path', 'server']} /> | ||
|
||
Globally configure the CLI with the authorization token, the path where the configuration file will be stored and the server to reach during the build. These parameters are optional and can be passed when running the build command. | | ||
|
||
## wasmo config get | ||
Get the configuration from the configured path file or from `$HOME/.wasmo` | | ||
|
||
## wasmo config reset | ||
Clean configuration and reset to default settings. The default file path configuration will be `$HOME/.wasmo` || | ||
|
||
## wasmo init <Badges values={['template', 'name', 'path']} /> | ||
Initialize a WASM plugin to the specific path. You can choose between many templates, javascript/typescript (js/ts), Open Policy Agent (opa), Rust or Golang (go). | | ||
|
||
## wasmo build <Badges values={['path', 'host', 'server', 'token']} /> | ||
Build the plugin by sending the contents to the remote or local Wasmo server. As soon as the build is complete, the WASM binary is donwloaded and saved in the plugin folder. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use client" | ||
|
||
import Layout from '@/components/Layout'; | ||
import Page from './_page.mdx'; | ||
|
||
export default function Home() { | ||
|
||
return <Layout | ||
metadata={{ | ||
title: 'CLI - Getting started', | ||
href: '/cli/getting-started' | ||
}} | ||
previous={{ | ||
href: "/cli/getting-started", | ||
title: "CLI - Getting started" | ||
}} | ||
next={{ | ||
href: "/cli/configuration-file", | ||
title: "CLI - Configuration fle" | ||
}}> | ||
<Page /> | ||
</Layout> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import Badges from '../../../components/Badges' | ||
|
||
# Wasmo CLI | ||
|
||
# Installation | ||
|
||
This project can be installed and compiled from source with this Cargo command: | ||
|
||
``` | ||
$ cargo install wasmo | ||
or | ||
$ brew install wasmo (coming soon) | ||
``` | ||
|
||
Additionally there are [precompiled artifacts built on CI][artifacts] which are | ||
available for download as well. | ||
|
||
[artifacts]: https://github.com/MAIF/wasmo/releases | ||
|
||
Installation can be confirmed with: | ||
|
||
``` | ||
$ wasmo --version | ||
``` | ||
|
||
Subcommands can be explored with: | ||
|
||
``` | ||
$ wasmo help | ||
``` | ||
|
||
# Quick start | ||
|
||
``` | ||
wasmo init --name=my-first-plugin --templates=js | ||
wasmo build --host=OneShotDocker --path=my-first-plugin --token=foobar | ||
``` | ||
|
||
Then open the content of your `my-first-plugin` folder. You should find the generated WASM binary named `my-first-plugin-1.0.0.wasm`. | ||
|
||
## Selecting a template | ||
|
||
You can now optionally start a new plugin from a template by appending `--template=[template-name]` to the creation command. | ||
|
||
If you don't pass a template, Wasmo will list the available templates: `js`, `ts`, `opa`, `go` and `rust`. | ||
|
||
``` | ||
wasmo init --name=my-first-plugin --templates=[template-name] --path=[output-directory] | ||
``` | ||
|
||
Running this command with any of theses templates will create a directory called `my-first-plugin` inside the specified output directory (or the current if omitted). Inside that directory, it will generate the initial project structure with the metadata file pre-filled with the name of your plugin. | ||
|
||
## Creating a production WASM binary | ||
|
||
`wasmo build` starts the process to build a WASM binary of your plugin. Inside the plugin directory will be your WASM binary and sources. | ||
|
||
You have two ways to build your plugin: | ||
- locally with Docker | ||
- remotely by deploying a [Wasmo server][wasmoserver] | ||
|
||
[wasmoserver]: https://github.com/MAIF/wasmo | ||
|
||
Assuming we want to build our `my-first-plugin` locally. Enter `wasmo build --host=OneShotDocker --path=my-first-plugin --token=foobar` to start the build. | ||
|
||
Let's explain these 3 parameters: | ||
- the `path` parameter is explicitly used to indicate the plugin to build | ||
- the `host` indicates which kind of Wasmo server used. The pratical way is to use `Docker` or `OneShotDocker` because it prevents to install a Wasmo server by deploying, inside your locally Docker, a new Wasmo container. The last possible value is `Remote` and can be used to specify with a URI the remote Wasmo server used. | ||
- the `token` argument is passed to the Wasmo server to authenticate the CLI. It can also be set up in the [configuration file][#configure-your-configuration-file] | ||
|
||
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/NdbQR6vQ5Sk/0.jpg)](https://www.youtube.com/watch?v=NdbQR6vQ5Sk) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use client" | ||
|
||
import Layout from '@/components/Layout'; | ||
import Page from './_page.mdx'; | ||
|
||
export default function Home() { | ||
|
||
return <Layout | ||
metadata={{ | ||
title: 'CLI - Getting started', | ||
href: '/cli/getting-started' | ||
}} | ||
previous={{ | ||
href: "/builder/ui", | ||
title: "Builder - UI" | ||
}} | ||
next={{ | ||
href: "/cli/core-commands", | ||
title: "CLI - Core commands" | ||
}}> | ||
<Page /> | ||
</Layout> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Integration with Otoroshi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"use client" | ||
|
||
import Layout from '@/components/Layout'; | ||
import Page from './_page.mdx'; | ||
|
||
export default function Home() { | ||
|
||
return <Layout | ||
metadata={{ | ||
title: 'Integrations - Otoroshi', | ||
href: '/integrations/otoroshi' | ||
}} | ||
previous={{ | ||
href: "/cli/configuration-file", | ||
title: "CLI - Configuration file" | ||
}}> | ||
<Page /> | ||
</Layout> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Badges({ values }) { | ||
return <div className="inline-flex ms-6 flex items-center mt-2" style={{ gap: '.5rem' }}> | ||
{values.map(value => <span key={value} className="whitespace-nowrap rounded-full bg-purple-100 px-2.5 py-0.5 text-sm text-purple-700"> | ||
{`<${value}>`} | ||
</span>)} | ||
</div> | ||
} |
Oops, something went wrong.