config

package
v0.33.23 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 27 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ConfigFileVersion = 2
View Source
const LocalImageTemplate string = templatePreamble + opaLocalPolicyImage + topazFileDecisionLoggerPlugin + asertoEdgePlugin
View Source
const RemoteImageTemplate string = templatePreamble + opaRemotePolicyImage + topazFileDecisionLoggerPlugin + asertoEdgePlugin

Variables

View Source
var CertificateSets = []string{"grpc", "gateway"}

Functions

func FileExists

func FileExists(path string) (bool, error)

func GetConfig

func GetConfig(configFilePath string) *currentConfig

func NewLoggerConfig

func NewLoggerConfig(configPath Path, overrides Overrider) (*logger.Config, error)

NewLoggerConfig creates a new LoggerConfig.

func PortFromAddress

func PortFromAddress(address string) (string, error)

func SetEnvVars

func SetEnvVars(fileContents string) (string, error)

Types

type APIKey

type APIKey struct {
	Key     string `json:"key"`
	Account string `json:"account"`
}

type AuthnConfig

type AuthnConfig struct {
	APIKeys map[string]string `json:"api_keys"`
	Options CallOptions       `json:"options"`
	Keys    []string          `json:"keys"`
}

type CallOptions

type CallOptions struct {
	Default   Options           `json:"default"`
	Overrides []OptionOverrides `json:"overrides"`
}

func (*CallOptions) ForPath

func (co *CallOptions) ForPath(path string) *Options

type CommandMode

type CommandMode int

CommandMode -- enum type.

const (
	CommandModeUnknown CommandMode = 0 + iota
	CommandModeRun
	CommandModeBuild
)

CommandMode -- enum constants.

type Common

type Common struct {
	Version      int           `json:"version"`
	Logging      logger.Config `json:"logging"`
	DebugService debug.Config  `json:"debug_service"`

	Command struct {
		Mode CommandMode
	} `json:"-"`

	APIConfig ServicesConfig `json:"api"`

	JWT JWT `json:"jwt"`

	// Directory configuration
	Edge directory.Config `json:"directory"`

	// Authorizer directory resolver configuration
	DirectoryResolver client.Config `json:"remote_directory"`

	// Default OPA configuration
	OPA runtime.Config `json:"opa"`
}

Common holds the shared configuration elements.

type Config

type Config struct {
	Common `json:"common,squash"` //nolint:staticcheck // squash is used by mapstructure

	Auth AuthnConfig `json:"auth"`
}

func NewConfig

func NewConfig(
	configPath Path,
	log *zerolog.Logger,
	overrides Overrider,
	certsGenerator *certs.Generator,
) (
	*Config,
	error,
)

NewConfig creates the configuration by reading env & files.

type Generator

type Generator struct {
	ConfigName string
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(configName string) *Generator

func (*Generator) CreateCertsDir

func (g *Generator) CreateCertsDir() (string, error)

func (*Generator) CreateConfigDir

func (g *Generator) CreateConfigDir() (string, error)

func (*Generator) CreateDataDir

func (g *Generator) CreateDataDir() (string, error)

func (*Generator) GenerateConfig

func (g *Generator) GenerateConfig(w io.Writer, templateData string) error

func (*Generator) WithConfigName added in v0.33.15

func (g *Generator) WithConfigName(configName string) *Generator

func (*Generator) WithEdgeDirectory

func (g *Generator) WithEdgeDirectory(enabled bool) *Generator

func (*Generator) WithEnableDirectoryV2

func (g *Generator) WithEnableDirectoryV2(enabled bool) *Generator

func (*Generator) WithLocalPolicy

func (g *Generator) WithLocalPolicy(local bool) *Generator

func (*Generator) WithPolicyName

func (g *Generator) WithPolicyName(policyName string) *Generator

func (*Generator) WithResource

func (g *Generator) WithResource(resource string) *Generator

func (*Generator) WithVersion

func (g *Generator) WithVersion(version int) *Generator

type JWT added in v0.33.16

type JWT struct {
	AcceptableTimeSkewSeconds int      `json:"acceptable_time_skew_seconds"` // Duration which exp (Expiry) and nbf (Not Before) claims may differ
	AllowedIssuers            []string `json:"allowed_issuers"`              // NOTE: if this list is empty the behavior defaults to InsecureWhitelist
	CacheRefreshMinInterval   string   `json:"cache_refresh_min_interval"`
	CacheRefreshMaxInterval   string   `json:"cache_refresh_max_interval"`
	ExpectedAudience          string   `json:"expected_audience"`
}

func (*JWT) AcceptableTimeSkewDuration added in v0.33.16

func (j *JWT) AcceptableTimeSkewDuration() time.Duration

func (*JWT) CacheRefreshMaxIntervalDuration added in v0.33.16

func (j *JWT) CacheRefreshMaxIntervalDuration() time.Duration

func (*JWT) CacheRefreshMinIntervalDuration added in v0.33.16

func (j *JWT) CacheRefreshMinIntervalDuration() time.Duration

type Loader

type Loader struct {
	Configuration *Config
	HasTopazDir   bool
}

func LoadConfiguration

func LoadConfiguration(fileName string) (*Loader, error)

func (*Loader) GetPaths

func (l *Loader) GetPaths() ([]string, error)

func (*Loader) GetPorts

func (l *Loader) GetPorts() ([]string, error)

type LoggerConfig

type LoggerConfig Config

LoggerConfig is a basic Config copy that gets loaded before everything else, so we can log during resolving configuration.

type OptionOverrides

type OptionOverrides struct {
	// API paths to override
	Paths []string `json:"paths"`
	// Override options
	Override Options `json:"override"`
}

type Options

type Options struct {
	// API Key for machine-to-machine communication, internal to Aserto
	EnableAPIKey bool `json:"enable_api_key"`
	// Allows calls without any form of authentication
	EnableAnonymous bool `json:"enable_anonymous"`
}

type Overrider

type Overrider func(*Config)

Overrider is a func that mutates configuration.

type Path

type Path string

Path represents the path to a configuration file.

type ServicesConfig

type ServicesConfig struct {
	Health struct {
		ListenAddress string           `json:"listen_address"`
		Certificates  client.TLSConfig `json:"certs"`
	} `json:"health"`
	Metrics struct {
		ListenAddress string           `json:"listen_address"`
		Certificates  client.TLSConfig `json:"certs"`
		ZPages        bool             `json:"zpages"`
	} `json:"metrics"`
	Services map[string]*builder.API `json:"services"`
}

Jump to

Keyboard shortcuts

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