config

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 15

Documentation

Overview

Package config implements OPA configuration file parsing and validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Services                     json.RawMessage            `json:"services"`
	Labels                       map[string]string          `json:"labels"`
	Discovery                    json.RawMessage            `json:"discovery"`
	Bundle                       json.RawMessage            `json:"bundle"` // Deprecated: Use `bundles` instead
	Bundles                      json.RawMessage            `json:"bundles"`
	DecisionLogs                 json.RawMessage            `json:"decision_logs"`
	Status                       json.RawMessage            `json:"status"`
	Plugins                      map[string]json.RawMessage `json:"plugins"`
	Keys                         json.RawMessage            `json:"keys"`
	DefaultDecision              *string                    `json:"default_decision"`
	DefaultAuthorizationDecision *string                    `json:"default_authorization_decision"`
	Caching                      json.RawMessage            `json:"caching"`
	PersistenceDirectory         *string                    `json:"persistence_directory"`
}

Config represents the configuration file that OPA can be started with.

func ParseConfig

func ParseConfig(raw []byte, id string) (*Config, error)

ParseConfig returns a valid Config object with defaults injected. The id and version parameters will be set in the labels map.

func (Config) DefaultAuthorizationDecisionRef

func (c Config) DefaultAuthorizationDecisionRef() ast.Ref

DefaultAuthorizationDecisionRef returns the default authorization decision as a reference.

func (Config) DefaultDecisionRef

func (c Config) DefaultDecisionRef() ast.Ref

DefaultDecisionRef returns the default decision as a reference.

func (Config) GetPersistenceDirectory added in v0.27.0

func (c Config) GetPersistenceDirectory() (string, error)

GetPersistenceDirectory returns the configured persistence directory, or $PWD/.opa if none is configured

func (Config) PluginsEnabled

func (c Config) PluginsEnabled() bool

PluginsEnabled returns true if one or more plugin features are enabled.

Jump to

Keyboard shortcuts

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