Documentation
¶
Overview ¶
Package config contains all the configuration attributes for running Optimizely Agent
Index ¶
- Variables
- type APIConfig
- type AdminConfig
- type AgentConfig
- type BatchRequestsConfig
- type CORSConfig
- type ClientConfig
- type LogConfig
- type OAuthClientCredentials
- type PluginConfigs
- type RuntimeConfig
- type ServerConfig
- type ServiceAuthConfig
- type UserProfileServiceConfigs
- type WebhookConfig
- type WebhookProject
Constants ¶
This section is empty.
Variables ¶
var AuthDisabledWarningTemplate = "Authorization not enabled for %v endpoint. For production deployments, authorization is recommended."
AuthDisabledWarningTemplate is used to log a warning when auth is disabled for API or Admin endpoints
var HTTPSDisabledWarning = "" /* 219-byte string literal not displayed */
HTTPSDisabledWarning is logged when keyfile and certfile are not provided in server configuration
Functions ¶
This section is empty.
Types ¶
type APIConfig ¶
type APIConfig struct {
Auth ServiceAuthConfig `json:"-"`
CORS CORSConfig `json:"cors"`
MaxConns int `json:"maxConns"`
Port string `json:"port"`
EnableNotifications bool `json:"enableNotifications"`
EnableOverrides bool `json:"enableOverrides"`
}
APIConfig holds the REST API configuration
type AdminConfig ¶
type AdminConfig struct {
Auth ServiceAuthConfig `json:"-"`
Port string `json:"port"`
}
AdminConfig holds the configuration for the admin web interface
type AgentConfig ¶
type AgentConfig struct {
Version string `json:"version"`
Author string `json:"author"`
Name string `json:"name"`
SDKKeys []string `yaml:"sdkKeys" json:"sdkKeys"`
Admin AdminConfig `json:"admin"`
API APIConfig `json:"api"`
Log LogConfig `json:"log"`
Client ClientConfig `json:"client"`
Runtime RuntimeConfig `json:"runtime"`
Server ServerConfig `json:"server"`
Webhook WebhookConfig `json:"webhook"`
}
AgentConfig is the top level configuration struct
func NewDefaultConfig ¶
func NewDefaultConfig() *AgentConfig
NewDefaultConfig returns the default configuration for Optimizely Agent
func (*AgentConfig) LogConfigWarnings ¶
func (ac *AgentConfig) LogConfigWarnings()
LogConfigWarnings checks this configuration and logs any relevant warnings.
type BatchRequestsConfig ¶
type BatchRequestsConfig struct {
MaxConcurrency int `json:"maxConcurrency"`
OperationsLimit int `json:"operationsLimit"`
}
BatchRequestsConfig holds the configuration for batching
type CORSConfig ¶
type CORSConfig struct {
AllowedOrigins []string `json:"allowedOrigins"`
AllowedMethods []string `json:"allowedMethods"`
AllowedHeaders []string `json:"allowedHeaders"`
ExposedHeaders []string `json:"exposedHeaders"`
AllowedCredentials bool `json:"allowedCredentials"`
MaxAge int `json:"maxAge"`
}
CORSConfig holds the CORS middleware configuration
type ClientConfig ¶
type ClientConfig struct {
PollingInterval time.Duration `json:"pollingInterval"`
BatchSize int `json:"batchSize" default:"10"`
QueueSize int `json:"queueSize" default:"1000"`
FlushInterval time.Duration `json:"flushInterval" default:"30s"`
DatafileURLTemplate string `json:"datafileURLTemplate"`
EventURL string `json:"eventURL"`
SdkKeyRegex string `json:"sdkKeyRegex"`
UserProfileService UserProfileServiceConfigs `json:"userProfileService"`
}
ClientConfig holds the configuration options for the Optimizely Client.
type LogConfig ¶
type LogConfig struct {
Pretty bool `json:"pretty"`
IncludeSDKKey bool `json:"includeSdkKey" default:"true"`
Level string `json:"level"`
}
LogConfig holds the log configuration
type OAuthClientCredentials ¶
type OAuthClientCredentials struct {
ID string `yaml:"id"`
SecretHash string `yaml:"secretHash"`
SDKKeys []string `yaml:"sdkKeys"`
}
OAuthClientCredentials are used for issuing access tokens
type PluginConfigs ¶
type PluginConfigs map[string]interface{}
PluginConfigs defines the generic mapping of middleware plugins
type RuntimeConfig ¶
type RuntimeConfig struct {
// SetBlockProfileRate controls the fraction of goroutine blocking events
// that are reported in the blocking profile. The profiler aims to sample
// an average of one blocking event per rate nanoseconds spent blocked.
//
// To include every blocking event in the profile, pass rate = 1.
// To turn off profiling entirely, pass rate <= 0.
BlockProfileRate int `json:"blockProfileRate"`
// mutexProfileFraction controls the fraction of mutex contention events
// that are reported in the mutex profile. On average 1/rate events are
// reported. The previous rate is returned.
//
// To turn off profiling entirely, pass rate 0.
// To just read the current rate, pass rate < 0.
// (For n>1 the details of sampling may change.)
MutexProfileFraction int `json:"mutexProfileFraction"`
}
RuntimeConfig holds any configuration related to the native runtime package These should only be configured when debugging in a non-production environment.
type ServerConfig ¶
type ServerConfig struct {
AllowedHosts []string `json:"allowedHosts"`
ReadTimeout time.Duration `json:"readTimeout"`
WriteTimeout time.Duration `json:"writeTimeout"`
CertFile string `json:"certFile"`
KeyFile string `json:"keyFile"`
DisabledCiphers []string `json:"disabledCiphers"`
HealthCheckPath string `json:"healthCheckPath"`
Host string `json:"host"`
BatchRequests BatchRequestsConfig `json:"batchRequests"`
Interceptors PluginConfigs `json:"interceptors"`
}
ServerConfig holds the global http server configs
func (*ServerConfig) GetAllowedHosts ¶
func (sc *ServerConfig) GetAllowedHosts() []string
GetAllowedHosts returns the allowed hosts for this server. Requests whose host is not found in this slice should be rejected by the server.
type ServiceAuthConfig ¶
type ServiceAuthConfig struct {
Clients []OAuthClientCredentials `yaml:"clients" json:"-"`
HMACSecrets []string `yaml:"hmacSecrets" json:"-"`
TTL time.Duration `yaml:"ttl" json:"-"`
JwksURL string `yaml:"jwksURL"`
JwksUpdateInterval time.Duration `yaml:"jwksUpdateInterval"`
}
ServiceAuthConfig holds the authentication configuration for a particular service
type UserProfileServiceConfigs ¶
type UserProfileServiceConfigs map[string]interface{}
UserProfileServiceConfigs defines the generic mapping of userprofileservice plugins
type WebhookConfig ¶
type WebhookConfig struct {
Port string `json:"port"`
Projects map[int64]WebhookProject `json:"projects"`
}
WebhookConfig holds configuration for Optimizely Webhooks
type WebhookProject ¶
type WebhookProject struct {
SDKKeys []string `json:"sdkKeys"`
Secret string `json:"-"`
SkipSignatureCheck bool `json:"skipSignatureCheck" default:"false"`
}
WebhookProject holds the configuration for a single Project webhook