Skip to content

Conversation

@andrewcameronsims
Copy link
Contributor

Why the changes in this PR are needed?

My team wanted to use the SDK client in a very simple use case without using a bundle server to distribute policy. The documents did not cover this use case and I spent a lot of time figuring out how to do it. Adding this to the documentation will help other users who may later find themselves in this same situation.

What are the changes in this PR?

A short description on the kind of configuration that is needed to instantiate the SDK client without a real or mock bundle server.

Further comments:

Discussion on the community slack: https://openpolicyagent.slack.com/archives/C02L1TLPN59/p1768513465312369

@andrewcameronsims andrewcameronsims marked this pull request as draft January 23, 2026 02:44
@netlify
Copy link

netlify bot commented Jan 23, 2026

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 79fb05f
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/6972e0a5c44bfc000844779a
😎 Deploy Preview https://deploy-preview-8248--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 23, 2026

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit e3976ad
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/6977e313ba015c0008a9f42a
😎 Deploy Preview https://deploy-preview-8248--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@andrewcameronsims andrewcameronsims marked this pull request as ready for review January 23, 2026 22:41

#### Using the SDK client without a server

In certain cases, you might want to use the high-level SDK to read in policy from the filesystem instead of a real or mock bundle server.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In certain cases, you might want to use the high-level SDK to read in policy from the filesystem instead of a real or mock bundle server.
You might want to use the high-level SDK to load policy from the filesystem instead of a bundle server. This can we useful if you do not have a bundle server, or you ship policy with the application using the SDK.

#### Using the SDK client without a server

In certain cases, you might want to use the high-level SDK to read in policy from the filesystem instead of a real or mock bundle server.
In that case, you can use the SDK as per normal, but modify the configuration to use a filepath url instead of the server path. You
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In that case, you can use the SDK as per normal, but modify the configuration to use a filepath url instead of the server path. You
In that case, you can use the SDK as normal, but modify the configuration to use a file scheme and path, instead of a HTTP server resource path. You

}
}`, bundleFilePath))

// create an instance of the OPA object and use it to get policy decisions as per normal.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// create an instance of the OPA object and use it to get policy decisions as per normal.
// create an instance of the OPA object and use it to get policy decisions as normal.

Copy link
Contributor

@charlieegan3 charlieegan3 left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks for writing it up.

@andrewcameronsims
Copy link
Contributor Author

Thank you for those suggestions, I have accepted all of them.

It's possible to read in policies from the filesystem, but there's no
detail on how to do this in the current documentation. Adding this
provides more information for use cases where features of the server
(e.g. dynamic bundle loading) are not important to the user.

Signed-off-by: Andrew Sims <[email protected]>
@sspaink sspaink merged commit 653453a into open-policy-agent:main Jan 26, 2026
20 checks passed
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