Files
releases/cmd/errors.go
T
Torin Sandall eee76c6365 Update subcommands to support loader filter
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>
2018-06-22 14:22:14 -07:00

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)")
}