-
Notifications
You must be signed in to change notification settings - Fork 1.5k
docs: explain how to use the SDK without a initialising a server #8248
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
docs: explain how to use the SDK without a initialising a server #8248
Conversation
79fb05f to
7bc92fe
Compare
✅ Deploy Preview for openpolicyagent ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for openpolicyagent ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
docs/docs/integration.md
Outdated
|
|
||
| #### 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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. |
docs/docs/integration.md
Outdated
| #### 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 |
docs/docs/integration.md
Outdated
| } | ||
| }`, bundleFilePath)) | ||
|
|
||
| // create an instance of the OPA object and use it to get policy decisions as per normal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // 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. |
charlieegan3
left a comment
There was a problem hiding this 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.
7bc92fe to
7fea4a2
Compare
|
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]>
7fea4a2 to
e3976ad
Compare
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