Created
April 15, 2024 10:06
-
-
Save srenatus/15e54d12006811bf4d3ea062e861835a to your computer and use it in GitHub Desktop.
use @styra/opa from a browser -- for experiments! It's not somethng you want to do in most cases. ⚠️ Run OPA on http://localhost:8181, and `caddy run --config Caddyfile`
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
:8000 { | |
handle_path /opa/* { | |
reverse_proxy http://localhost:8181 | |
} | |
handle { | |
root * . | |
file_server | |
} | |
} |
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
<!doctype html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8" /> | |
<script type="importmap"> | |
{ | |
"imports": { | |
"opa": "https://esm.sh/@styra/[email protected]" | |
} | |
} | |
</script> | |
<script type="module"> | |
import { OPAClient } from "opa"; | |
const opa = new OPAClient(window.location + "opa/"); | |
const main = document.getElementById("main"); | |
main.innerHTML = JSON.stringify(await opa.authorize("system")); | |
</script> | |
</head> | |
<body> | |
<pre>:)</pre> | |
<pre id="main"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment