Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
handle /v1/* {
reverse_proxy http://eopa:8181
}
handle /exp/* {
reverse_proxy http://eopa:8181
}

handle {
root * /usr/share/caddy
Expand Down
4 changes: 0 additions & 4 deletions Caddyfile-local
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
reverse_proxy http://127.0.0.1:8181
}

handle /exp/* { # EOPA
reverse_proxy http://127.0.0.1:8181
}

handle { # Observable Framework's dev server
reverse_proxy http://127.0.0.1:3000
}
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- eopa

eopa:
image: ${EOPA_IMAGE:-ghcr.io/styrainc/enterprise-opa:edge}
image: ${EOPA_IMAGE:-ghcr.io/styrainc/enterprise-opa:latest}
pull_policy: ${EOPA_PULL_POLICY:-always}
ports:
- "8181:8181"
Expand All @@ -17,6 +17,5 @@ services:
- --addr=:8181
- --log-level=debug
- --no-license-fallback
- --set=plugins.exp_compile_api={}
environment:
EOPA_LICENSE_KEY: ${EOPA_LICENSE_KEY:-}
4 changes: 2 additions & 2 deletions src/components/RegoEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function RegoEditor({
}
// If we make it this far, the policy is on the server, so let's compile it:
const { result, errors } = await (await compilePolicy(opa, input, mappings)).json();
const query = result;
const { query } = result;
if (errors) {
parent.value = String(""); // this means "no query produced"
parent.dispatchEvent(new InputEvent("input", {bubbles: true}));
Expand All @@ -53,7 +53,7 @@ export function RegoEditor({
});
}

parent.value = String(result); // TODO(sr) check this
parent.value = String(query);
parent.dispatchEvent(new InputEvent("input", {bubbles: true}));
return [];
}, {
Expand Down
9 changes: 5 additions & 4 deletions src/components/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ export async function putPolicy(opa, id, code, raise = true) {
}

export async function compilePolicy(opa, input, mappings = {}, query = "data.filters.include") {
const resp = await fetch(`${opa}exp/compile`, {
const resp = await fetch(`${opa}v1/compile`, {
method: "POST",
body: JSON.stringify({
input,
query,
options: {
dialect: "postgres",
targetSQLTableMappings: mappings,
targetSQLTableMappings: {
postgres: mappings,
},
},
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/vnd.styra.sql+json"
"Accept": "application/vnd.styra.sql.postgres+json"
},
});
return resp;
Expand Down
2 changes: 0 additions & 2 deletions src/policies/filters.rego
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ include if {
input.products.price < 500
input.users.name == user
}

_use_metadata := rego.metadata.rule()