config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package config contains all the configuration attributes for running Optimizely Agent

Index

Constants

This section is empty.

Variables

View Source
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

View Source
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 added in v1.3.0

func (ac *AgentConfig) LogConfigWarnings()

LogConfigWarnings checks this configuration and logs any relevant warnings.

type CORSConfig added in v1.1.0

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 added in v0.13.0

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"`
}

ClientConfig holds the configuration options for the Optimizely Client.

type LogConfig

type LogConfig struct {
	Pretty bool   `json:"pretty"`
	Level  string `json:"level"`
}

LogConfig holds the log configuration

type OAuthClientCredentials added in v0.12.0

type OAuthClientCredentials struct {
	ID         string   `yaml:"id"`
	SecretHash string   `yaml:"secretHash"`
	SDKKeys    []string `yaml:"sdkKeys"`
}

OAuthClientCredentials are used for issuing access tokens

type RuntimeConfig added in v1.3.0

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 {
	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"`
}

ServerConfig holds the global http server configs

type ServiceAuthConfig added in v0.12.0

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 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

Jump to

Keyboard shortcuts

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