package runtime

import "github.com/open-policy-agent/opa/runtime"

Package runtime contains the entry point to the policy engine.

Index

Functions

func NewLoggingHandler

func NewLoggingHandler(inner http.Handler) http.Handler

NewLoggingHandler returns a new http.Handler.

Types

type LoadedModule

type LoadedModule struct {
	Parsed *ast.Module
	Raw    []byte
}

LoadedModule represents a module that has been successfully loaded.

func RegoLoad

func RegoLoad(path string) (*LoadedModule, error)

RegoLoad loads and parses a rego source file.

type LoggingConfig

type LoggingConfig struct {
	Level  string
	Format string
}

LoggingConfig stores the configuration for OPA's logging behaviour.

type LoggingHandler

type LoggingHandler struct {
	// contains filtered or unexported fields
}

LoggingHandler returns an http.Handler that will print log messages containing the request information as well as response status and latency.

func (*LoggingHandler) ServeHTTP

func (h *LoggingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Params

type Params struct {

	// Addr is the listening address that the OPA server will bind to.
	Addr string

	// InsecureAddr is the listening address that the OPA server will bind to
	// in addition to Addr if TLS is enabled.
	InsecureAddr string

	// Authentication is the type of authentication scheme to use.
	Authentication server.AuthenticationScheme

	// Authorization is the type of authorization scheme to use.
	Authorization server.AuthorizationScheme

	// Certificate is the certificate to use in server-mode. If the certificate
	// is nil, the server will NOT use TLS.
	Certificate *tls.Certificate

	// Eval is a string to evaluate in the REPL.
	Eval string

	// HistoryPath is the filename to store the interactive shell user
	// input history.
	HistoryPath string

	// Output format controls how the REPL will print query results.
	// Default: "pretty".
	OutputFormat string

	// Paths contains filenames of base documents and policy modules to load on
	// startup. Data files may be prefixed with "<dotted-path>:" to indicate
	// where the contained document should be loaded.
	Paths []string

	// Server flag controls whether the OPA instance will start a server.
	// By default, the OPA instance acts as an interactive shell.
	Server bool

	// Watch flag controls whether OPA will watch the Paths files for changes.
	// If this flag is true, OPA will watch the Paths files for changes and
	// reload the storage layer each time they change. This is useful for
	// interactive development.
	Watch bool

	// ErrorLimit is the number of errors the compiler will allow to occur before
	// exiting early.
	ErrorLimit int

	// ServerDiagnosticsBufferSize is the size of the server's diagnostic buffer.
	ServerDiagnosticsBufferSize int

	// Logging configures the logging behaviour.
	Logging LoggingConfig

	// Output is the output stream used when run as an interactive shell. This
	// is mostly for test purposes.
	Output io.Writer
}

Params stores the configuration for an OPA instance.

func NewParams

func NewParams() *Params

NewParams returns a new Params object.

type Runtime

type Runtime struct {
	Store storage.Store
}

Runtime represents a single OPA instance.

func (*Runtime) Start

func (rt *Runtime) Start(params *Params)

Start is the entry point of an OPA instance.

Source Files

doc.go loader.go logging.go merge.go runtime.go

Version
v0.5.6
Published
Aug 29, 2017
Platform
js/wasm
Imports
28 packages
Last checked
2 hours ago

Tools for package owners.