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

support customBuiltins parameter in loadPolicy #165

Merged
merged 1 commit into from
Mar 30, 2022

Conversation

abrgr
Copy link
Contributor

@abrgr abrgr commented Mar 30, 2022

Hi,

This PR adds support for custom builtins by adding an additional parameter to loadPolicy, somewhat related to the discussion in #23.

One potential point of contention is that this always favors first-party builtins over provided builtins.

P.S. opa is fantastic - great work!

Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you this is a great contribution 👏

@srenatus srenatus merged commit 230febc into open-policy-agent:main Mar 30, 2022
@udnes99
Copy link

udnes99 commented Aug 20, 2023

This contribution is greatly appreciated!
I have one question about providing async functions--Is it possible?
For example, this would be needed to implement a function to make HTTP calls.

I tried providing an async function when loading the rego used for testing here; simply made the provided function to custom.zeroArgBuiltin async.
It does not seem to work, and the result is not the expected string, but an empty object.

@srenatus
Copy link
Contributor

I have one question about providing async functions--Is it possible?

I don't think so. For one thing, to have wasm interactions work with anything async would mean to either process the wasm module with emscripten's asyncify, or deal with it manually, see this blog post.

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 this pull request may close these issues.

3 participants