mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
b65c68e340
Support OPA Client SDK programs loading bundles from an arbitraty filesystem, such as an in-memory filesystem, which unlocks additional uses that include compiling a bundle to an intermediate representation from a client program rather than the OPA command line. Fixes #5833 bundle: Add filesystem support Soften constraint in `Equal` method to support bundle comparison for rootless filesystems, eg treat "/file" and "file" as equal for both URLs and Paths Add `WithPathFormat` for `DirectoryLoader` builders to centralise logic for how paths are returned during file traversal, ie in `NextFile` Add support for specifiying the root directory for `dirLoaderFS` compile: Add filesystem support Add `WithFS` builder helper to pass into `initload.LoadPaths` to load bundles from a filesystem internal/runtime/init: Add filesystem support Pass newly supplied `fsys fs.FS` parameter in `LoadPaths` into file loader builder loader: Add filesystem support Add new `GetBundleDirectLoaderFS` which can load bundles from the supplied filesystem runtime: Add filesystem support Pass-through nil parameter as `fsys fs.FS` parameter into `initLoad.LoadPaths` (OPA servers/repls are not in scope for loading from filesystem) util/test: Add in-memory filesystem support Add new `WithTestFS` helper to allow tests that currently use `WithTempFS` to choose between a disk-based or memory-based filesystem - now used throughout `compile_test` Signed-off-by: Kieran Othen <kieran.othen@mac.com>