Documentation
¶
Overview ¶
Package config implements OPA configuration file parsing and validation.
Index ¶
- Constants
- type Config
- func (c *Config) ActiveConfig() (any, error)
- func (c *Config) Clone() *Config
- func (c Config) DefaultAuthorizationDecisionRef() ast.Ref
- func (c Config) DefaultDecisionRef() ast.Ref
- func (c Config) GetPersistenceDirectory() (string, error)
- func (c Config) NDBuiltinCacheEnabled() bool
- func (c Config) PluginNames() (result []string)
- func (c Config) PluginsEnabled() booldeprecated
- type ServerConfig
- type StorageConfig
Constants ¶
const ( // DefaultMinTLSVersion is the minimum TLS version used by OPA server and REST clients DefaultMinTLSVersion = tls.VersionTLS12 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Services json.RawMessage `json:"services,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Discovery json.RawMessage `json:"discovery,omitempty"`
Bundle json.RawMessage `json:"bundle,omitempty"` // Deprecated: Use `bundles` instead
Bundles json.RawMessage `json:"bundles,omitempty"`
DecisionLogs json.RawMessage `json:"decision_logs,omitempty"`
Status json.RawMessage `json:"status,omitempty"`
Plugins map[string]json.RawMessage `json:"plugins,omitempty"`
Keys json.RawMessage `json:"keys,omitempty"`
DefaultDecision *string `json:"default_decision,omitempty"`
DefaultAuthorizationDecision *string `json:"default_authorization_decision,omitempty"`
Caching json.RawMessage `json:"caching,omitempty"`
NDBuiltinCache bool `json:"nd_builtin_cache,omitempty"`
PersistenceDirectory *string `json:"persistence_directory,omitempty"`
DistributedTracing json.RawMessage `json:"distributed_tracing,omitempty"`
MetricsExport json.RawMessage `json:"metrics_export,omitempty"`
Server *ServerConfig `json:"server,omitempty"`
Storage *StorageConfig `json:"storage,omitempty"`
Extra map[string]json.RawMessage `json:"-"`
}
Config represents the configuration file that OPA can be started with.
func ParseConfig ¶
ParseConfig returns a valid Config object with defaults injected. The id and version parameters will be set in the labels map.
func (*Config) ActiveConfig ¶
ActiveConfig returns OPA's active configuration with the credentials and crypto keys removed
func (Config) DefaultAuthorizationDecisionRef ¶
DefaultAuthorizationDecisionRef returns the default authorization decision as a reference.
func (Config) DefaultDecisionRef ¶
DefaultDecisionRef returns the default decision as a reference.
func (Config) GetPersistenceDirectory ¶
GetPersistenceDirectory returns the configured persistence directory, or $PWD/.opa if none is configured
func (Config) NDBuiltinCacheEnabled ¶
NDBuiltinCacheEnabled returns if the ND builtins cache should be used.
func (Config) PluginNames ¶
PluginNames returns a sorted list of names of enabled plugins.
func (Config) PluginsEnabled
deprecated
type ServerConfig ¶ added in v1.8.0
type ServerConfig struct {
Metrics json.RawMessage `json:"metrics,omitempty"`
Encoding json.RawMessage `json:"encoding,omitempty"`
Decoding json.RawMessage `json:"decoding,omitempty"`
LoggerPlugin *string `json:"logger_plugin,omitempty"`
}
ServerConfig represents the different server configuration options.
func (*ServerConfig) Clone ¶ added in v1.8.0
func (s *ServerConfig) Clone() *ServerConfig
Clone creates a deep copy of ServerConfig.
type StorageConfig ¶ added in v1.8.0
type StorageConfig struct {
Disk json.RawMessage `json:"disk,omitempty"`
}
StorageConfig represents Config's storage options.
func (*StorageConfig) Clone ¶ added in v1.8.0
func (s *StorageConfig) Clone() *StorageConfig
Clone creates a deep copy of StorageConfig.