Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ChangeHook ¶
type ChangeHook func(configServices ServicesMap) error
ChangeHook is a function invoked when the configuration changes.
type Config ¶
type Config struct {
// DevMode specifies whether the service is running in development mode.
DevMode bool `mapstructure:"dev_mode" json:"dev_mode"`
// DB represents the configuration settings for the database.
DB db.Config `mapstructure:"db" json:"db"`
// Server represents the configuration settings for the server.
Server server.Config `mapstructure:"server" json:"server"`
// Logger represents the configuration settings for the logger.
Logger logger.Config `mapstructure:"logger" json:"logger"`
// Mode specifies which services to run.
// By default, it runs all services.
Mode []string `mapstructure:"mode" json:"mode" default:"[\"all\"]"`
// SDKConfig represents the configuration settings for the SDK.
SDKConfig SDKConfig `mapstructure:"sdk_config" json:"sdk_config"`
// Services represents the configuration settings for the services.
Services ServicesMap `mapstructure:"services"`
// Trace is for configuring open telemetry based tracing.
Trace tracing.Config `mapstructure:"trace"`
// contains filtered or unexported fields
}
Config represents the configuration settings for the service.
func LoadConfig ¶
LoadConfig loads configuration using the provided loader or creates a default Viper loader
func (*Config) AddOnConfigChangeHook ¶
func (c *Config) AddOnConfigChangeHook(hook ChangeHook)
AddOnConfigChangeHook adds a hook to the list of hooks to call when the configuration changes.
func (*Config) LogValue ¶
LogValue returns a slog.Value representation of the config. We exclude logging service configuration as it may contain sensitive information.
type Connection ¶
type Connection struct {
// Endpoint is the URL of the platform or service.
Endpoint string `mapstructure:"endpoint" json:"endpoint"`
// Plaintext specifies whether the SDK should use plaintext communication.
Plaintext bool `mapstructure:"plaintext" json:"plaintext" default:"false" validate:"boolean"`
// Insecure specifies whether the SDK should use insecure TLS communication.
Insecure bool `mapstructure:"insecure" json:"insecure" default:"false" validate:"boolean"`
}
type EnvironmentLoader ¶
type EnvironmentLoader struct {
// contains filtered or unexported fields
}
EnvironmentLoader implements Loader using Viper
func NewEnvironmentLoader ¶
func NewEnvironmentLoader(key, file string) (*EnvironmentLoader, error)
NewEnvironmentLoader creates a new Viper-based configuration loader to load from environment variables, from a default or specified file (or k8s config map), or some combination
func (*EnvironmentLoader) Close ¶
func (l *EnvironmentLoader) Close() error
Close closes the environment configuration loader
func (*EnvironmentLoader) Load ¶
func (l *EnvironmentLoader) Load(cfg *Config) error
Load loads the configuration into the provided struct
func (*EnvironmentLoader) Name ¶
func (l *EnvironmentLoader) Name() string
Name returns the name of the environment configuration loader
type Loader ¶
type Loader interface {
// Load loads the configuration into the provided struct
Load(cfg *Config) error
// Watch starts watching for configuration changes and invokes an onChange callback
Watch(ctx context.Context, cfg *Config, onChange func(context.Context) error) error
// Close closes the configuration loader
Close() error
// Name returns the name of the configuration loader
Name() string
}
Loader defines the interface for loading and managing configuration
type SDKConfig ¶
type SDKConfig struct {
// Connection to the Core Platform
CorePlatformConnection Connection `mapstructure:"core" json:"core"`
// Connection to an ERS if not in the core platform
EntityResolutionConnection Connection `mapstructure:"entityresolution" json:"entityresolution"`
// ClientID is the client ID used for client credentials grant.
// It is required together with ClientSecret.
ClientID string `mapstructure:"client_id" json:"client_id" validate:"required_with=ClientSecret"`
// ClientSecret is the client secret used for client credentials grant.
// It is required together with ClientID.
ClientSecret string `mapstructure:"client_secret" json:"client_secret" validate:"required_with=ClientID"`
}
SDKConfig represents the configuration for the SDK.
type ServiceConfig ¶
Config structure holding a single service.
func (ServiceConfig) LogValue ¶ added in v0.8.2
func (cfg ServiceConfig) LogValue() slog.Value
func (ServiceConfig) String ¶ added in v0.8.2
func (cfg ServiceConfig) String() string