runtime

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package runtime contains the entry point to the policy engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggingHandler

func NewLoggingHandler(inner http.Handler) http.Handler

NewLoggingHandler returns a new http.Handler.

Types

type LoggingHandler

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

LoggingHandler returns an http.Handler that will print log messages to glog 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

	// 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

	// PolicyDir is the filename of the directory to persist policy
	// definitions in. Policy definitions stored in this directory
	// are automatically loaded on startup.
	PolicyDir 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.
	// This flag is only supported if OPA instance is running as an interactive
	// shell. 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

	// 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 added in v0.2.2

func NewParams() *Params

NewParams returns a new Params object.

type Runtime

type Runtime struct {
	Store *storage.Storage
}

Runtime represents a single OPA instance.

func (*Runtime) Start

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

Start is the entry point of an OPA instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL