mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-14 20:32:27 -06:00
eee76c6365
These changes update the subcommands to support a file/directory name filter. This allows users to exclude certain files from being loaded. With these changes users can excldue private directories created by Kubernetes for volume-mounted ConfigMaps. As part of this change, update the Kubernetes deployment documentation to use the new --ignore flag, run OPA as a Deployment instead of as a ReplicationController, and generally improve the example. Fixes #782 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
19 lines
660 B
Go
19 lines
660 B
Go
// Copyright 2017 The OPA Authors. All rights reserved.
|
|
// Use of this source code is governed by an Apache2
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"github.com/open-policy-agent/opa/ast"
|
|
"github.com/spf13/pflag"
|
|
)
|
|
|
|
func setMaxErrors(fs *pflag.FlagSet, errLimit *int) {
|
|
fs.IntVarP(errLimit, "max-errors", "m", ast.CompileErrorLimitDefault, "set the number of errors to allow before compilation fails early")
|
|
}
|
|
|
|
func setIgnore(fs *pflag.FlagSet, ignoreNames *[]string) {
|
|
fs.StringSliceVarP(ignoreNames, "ignore", "", []string{}, "set file and directory names to ignore during loading (e.g., '.*' excludes hidden files)")
|
|
}
|