config

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address string

Address is the data structure holding an address.

func (Address) Lookup

func (a Address) Lookup(k string) (any, error)

Get returns the value associated to the given key. The key available for an Address type are "port" and "ip", allowing respectively to get the port and the ip from the address.

func (Address) String

func (a Address) String() string

String return the string representation of the address.

type Command

type Command interface {
	// contains filtered or unexported methods
}

Command is the command to execute after parsing the template.

type Config

type Config struct {
	GRPC       *GRPC       `default:"{}" key:"grpc"       mapstructure:"-"`
	HTTP       *HTTP       `default:"{}" key:"http"       mapstructure:"-"`
	Serverless *Serverless `default:"{}" key:"serverless" mapstructure:"-"`
	Shared     *Shared     `default:"{}" key:"shared"     mapstructure:"shared"`
	Log        *Log        `default:"{}" key:"log"        mapstructure:"log"    template:"-"`
	Core       *Core       `default:"{}" key:"core"       mapstructure:"core"   template:"-"`
	Vars       Vars        `default:"{}" key:"vars"       mapstructure:"vars"   template:"-"`
}

Config holds the reva configuration.

func Load

func Load(r io.Reader) (*Config, error)

Load loads the configuration from the reader.

func (*Config) ApplyTemplates

func (c *Config) ApplyTemplates(l Lookuper) error

ApplyTemplates applies the templates defined in the configuration, replacing the template string with the value pointed by the given key.

func (*Config) Dump

func (c *Config) Dump() map[string]any

Dump returns the configuration as a map.

func (*Config) Lookup

func (c *Config) Lookup(key string) (any, error)

Lookup gets the value associated to the given key in the config. The key is in the form <subkey1>.<subkey2>[<index>], allowing accessing recursively the config on subfields, in case of maps or structs or types implementing the Getter interface, or elements in a list by the given index.

type Core

type Core struct {
	MaxCPUs            string `key:"max_cpus"             mapstructure:"max_cpus"`
	ConfigDumpFile     string `key:"config_dump_file"     mapstructure:"config_dump_file"`
	TracingEnabled     bool   `default:"true"             key:"tracing_enabled"               mapstructure:"tracing_enabled"`
	TracingEndpoint    string `default:"localhost:6831"   key:"tracing_endpoint"              mapstructure:"tracing_endpoint"`
	TracingCollector   string `key:"tracing_collector"    mapstructure:"tracing_collector"`
	TracingServiceName string `key:"tracing_service_name" mapstructure:"tracing_service_name"`
	TracingService     string `key:"tracing_service"      mapstructure:"tracing_service"`
}

Core holds the core configuration.

type DriverConfig

type DriverConfig struct {
	Address Address        `key:"address"`
	Network string         `key:"network"`
	Label   string         `key:"-"`
	Config  map[string]any `key:",squash"` // this must be at the bottom!
}

DriverConfig holds the configuration for a driver.

type ErrKeyNotFound

type ErrKeyNotFound struct {
	Key string
}

ErrKeyNotFound is the error returned when a key does not exist in the configuration.

func (ErrKeyNotFound) Error

func (e ErrKeyNotFound) Error() string

Error returns a string representation of the ErrKeyNotFound error.

type FieldByIndex

type FieldByIndex struct{ Index int }

FieldByIndex instructs the template runner to get a field by an index.

type FieldByKey

type FieldByKey struct{ Key string }

FieldByKey instructs the template runner to get a field by a key.

type GRPC

type GRPC struct {
	Address          Address `key:"address"           mapstructure:"address"`
	Network          string  `default:"tcp"           key:"network"                    mapstructure:"network"`
	ShutdownDeadline int     `key:"shutdown_deadline" mapstructure:"shutdown_deadline"`
	EnableReflection bool    `key:"enable_reflection" mapstructure:"enable_reflection"`

	Services     map[string]ServicesConfig `key:"services"     mapstructure:"-"`
	Interceptors map[string]map[string]any `key:"interceptors" mapstructure:"-"`
	// contains filtered or unexported fields
}

GRPC holds the configuration for the GRPC services.

func (GRPC) ForEachInterceptor

func (i GRPC) ForEachInterceptor(f InterceptorFunc)

ForEachInterceptor iterates to each middleware calling the function f.

func (GRPC) ForEachService

func (i GRPC) ForEachService(f ServiceFunc)

ForEachService iterates to each service/driver calling the function f.

type HTTP

type HTTP struct {
	Network  string  `default:"tcp"  key:"network"           mapstructure:"network"`
	Address  Address `key:"address"  mapstructure:"address"`
	CertFile string  `key:"certfile" mapstructure:"certfile"`
	KeyFile  string  `key:"keyfile"  mapstructure:"keyfile"`

	Services    map[string]ServicesConfig `key:"services"    mapstructure:"-"`
	Middlewares map[string]map[string]any `key:"middlewares" mapstructure:"-"`
	// contains filtered or unexported fields
}

HTTP holds the configuration for the HTTP services.

func (HTTP) ForEachInterceptor

func (i HTTP) ForEachInterceptor(f InterceptorFunc)

ForEachInterceptor iterates to each middleware calling the function f.

func (HTTP) ForEachService

func (i HTTP) ForEachService(f ServiceFunc)

ForEachService iterates to each service/driver calling the function f.

type Interceptor

type Interceptor struct {
	Name   string
	Config map[string]any
}

Interceptor contains the configuration for an interceptor.

type InterceptorFunc

type InterceptorFunc func(*Interceptor)

InterceptorFunc is an helper function used to pass the interface config to the ForEachInterceptor func.

type Log

type Log struct {
	Output string `default:"stdout"  key:"output" mapstructure:"output"`
	Mode   string `default:"console" key:"mode"   mapstructure:"mode"`
	Level  string `default:"trace"   key:"level"  mapstructure:"level"`
}

Log holds the configuration for the logger.

type Lookuper

type Lookuper interface {
	// Lookup get the value associated to thye given key.
	// It returns ErrKeyNotFound if the key does not exists.
	Lookup(key string) (any, error)
}

Lookuper is the interface for getting the value associated with a given key.

type Serverless

type Serverless struct {
	Services map[string]map[string]any `key:"services" mapstructure:"services"`
}

Serverless holds the configuration for the serverless services.

func (*Serverless) ForEach

func (s *Serverless) ForEach(f func(name string, config map[string]any) error) error

ForEach iterates to each service calling the function f.

type Service

type Service struct {
	Address Address
	Network string
	Name    string
	Label   string
	Config  map[string]any
	// contains filtered or unexported fields
}

Service contains the configuration for a service.

func (*Service) SetAddress

func (s *Service) SetAddress(address Address)

SetAddress sets the address for the service in the configuration.

type ServiceFunc

type ServiceFunc func(*Service)

ServiceFunc is an helper function used to pass the service config to the ForEachService func.

type ServicesConfig

type ServicesConfig []*DriverConfig

ServicesConfig holds the configuration for reva services.

func (*ServicesConfig) Add

func (s *ServicesConfig) Add(domain, svc string, c *DriverConfig)

Add appends the driver configuration to the given list of services.

func (ServicesConfig) DriversNumber

func (s ServicesConfig) DriversNumber() int

DriversNumber return the number of driver configured for the service.

type Shared

type Shared struct {
	JWTSecret             string   `default:"changemeplease"                   key:"jwt_secret"                         mapstructure:"jwt_secret"`
	GatewaySVC            string   `default:"0.0.0.0:19000"                    key:"gatewaysvc"                         mapstructure:"gatewaysvc"`
	DataGateway           string   `default:"http://0.0.0.0:19001/datagateway" key:"datagateway"                        mapstructure:"datagateway"`
	SkipUserGroupsInToken bool     `key:"skip_user_groups_in_token"            mapstructure:"skip_user_groups_in_token"`
	BlockedUsers          []string `default:"[]"                               key:"blocked_users"                      mapstructure:"blocked_users"`
}

Shared holds the shared configuration.

type Vars

type Vars map[string]any

Vars holds the a set of configuration paramenters that can be references by other parts of the configuration.

Jump to

Keyboard shortcuts

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