-
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.
add documentation about new otoroshi templates
- Loading branch information
1 parent
e5bf436
commit 0f1b49d
Showing
139 changed files
with
2,643 additions
and
172 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.35 KB
cli/templates/otoroshi/languages/go/otoroshi_wasm_request_transformer.zip
Binary file not shown.
Binary file added
BIN
+1.36 KB
cli/templates/otoroshi/languages/go/otoroshi_wasm_response_transformer.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
cli/templates/otoroshi/languages/js/otoroshi_wasm_access_control/esbuild.js
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,12 @@ | ||
const esbuild = require('esbuild') | ||
|
||
esbuild | ||
.build({ | ||
entryPoints: ['index.js'], | ||
outdir: 'dist', | ||
bundle: true, | ||
sourcemap: true, | ||
minify: false, // might want to use true for production build | ||
format: 'cjs', // needs to be CJS for now | ||
target: ['es2020'] // don't go over es2020 because quickjs doesn't support it | ||
}) |
21 changes: 21 additions & 0 deletions
21
cli/templates/otoroshi/languages/js/otoroshi_wasm_access_control/index.js
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,21 @@ | ||
export function execute() { | ||
let context = JSON.parse(Host.inputString()) | ||
|
||
if (context.request.headers["foo"] === "bar") { | ||
const out = { | ||
result: true | ||
} | ||
Host.outputString(JSON.stringify(out)) | ||
} else { | ||
const error = { | ||
result: false, | ||
error: { | ||
message: "you're not authorized", | ||
status: 401 | ||
} | ||
} | ||
Host.outputString(JSON.stringify(error)) | ||
} | ||
|
||
return 0 | ||
} |
7 changes: 7 additions & 0 deletions
7
cli/templates/otoroshi/languages/js/otoroshi_wasm_access_control/package.json
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 @@ | ||
{ | ||
"name": "@@PLUGIN_NAME@@", | ||
"version": "@@PLUGIN_VERSION@@", | ||
"devDependencies": { | ||
"esbuild": "^0.17.9" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
cli/templates/otoroshi/languages/js/otoroshi_wasm_access_control/plugin.d.ts
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,9 @@ | ||
/* | ||
We must also describe the Wasm interface for our plug-in. | ||
We do this with a typescript module DTS file | ||
DO NOT DELETE THIS FILE | ||
*/ | ||
declare module 'main' { | ||
export function execute(): I32; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.32 KB
cli/templates/otoroshi/languages/js/otoroshi_wasm_request_transformer.zip
Binary file not shown.
Binary file added
BIN
+1.33 KB
cli/templates/otoroshi/languages/js/otoroshi_wasm_response_transformer.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+545 Bytes
cli/templates/otoroshi/languages/rust/otoroshi_wasm_access_control.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+545 Bytes
cli/templates/otoroshi/languages/rust/otoroshi_wasm_request_transformer.zip
Binary file not shown.
Binary file added
BIN
+547 Bytes
cli/templates/otoroshi/languages/rust/otoroshi_wasm_response_transformer.zip
Binary file not shown.
Binary file added
BIN
+340 Bytes
cli/templates/otoroshi/languages/rust/otoroshi_wasm_route_matcher.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.43 KB
cli/templates/otoroshi/languages/ts/otoroshi_wasm_request_transformer.zip
Binary file not shown.
Binary file added
BIN
+1.43 KB
cli/templates/otoroshi/languages/ts/otoroshi_wasm_response_transformer.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.