config

package
v0.0.0-...-cd4de6a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidator

func NewValidator() *validator.Validate

Types

type ExperimentConfig

type ExperimentConfig struct {
	// Keeping the ProjectID as a separate parameter for now, in the chance that
	// we need flexibility in the router -> experiment project association.
	ProjectID int        `json:"project_id"  validate:"required"`
	Variables []Variable `json:"variables" validate:"dive"`
}

ExperimentConfig is the experiment config saved on the Turing DB

type ExperimentManagerConfig

type ExperimentManagerConfig struct {
	Enabled                      bool                         `json:"enabled"`
	BaseURL                      string                       `json:"base_url"`      // Base URL for XP experiment REST API
	HomePageURL                  string                       `json:"home_page_url"` // Website URL for end-users to manage experiments
	RemoteUI                     RemoteUI                     `json:"remote_ui"`
	TreatmentServicePluginConfig TreatmentServicePluginConfig `json:"treatment_service_plugin_config"`
}

type ExperimentRunnerConfig

type ExperimentRunnerConfig struct {
	RequestParameters      []Variable     `json:"request_parameters" validate:"required,dive"`
	TreatmentServiceConfig *config.Config `json:"treatment_service_config" validate:"required,dive"`
}

ExperimentRunnerConfig is used to parse the XP runner config during initialization

func (*ExperimentRunnerConfig) Validate

func (cfg *ExperimentRunnerConfig) Validate() error

Validate validates the fields in the ExperimentRunnerConfig for expected values and returns any errors

type FieldSource

type FieldSource string
const (
	// PayloadFieldSource is used to represent the request payload
	PayloadFieldSource FieldSource = "payload"
	// HeaderFieldSource is used to represent the request header
	HeaderFieldSource FieldSource = "header"
	// NoneFieldSource is used to represent that there is no field source,
	// i.e., the variable has not been configured.
	NoneFieldSource FieldSource = "none"
)

type RemoteUI

type RemoteUI struct {
	Name   string `json:"name" validate:"required"`
	URL    string `json:"url" validate:"required"`
	Config string `json:"config,omitempty"`
}

type TreatmentServicePluginConfig

type TreatmentServicePluginConfig struct {
	Port                 int `json:"port" default:"8080"`
	PubSubTimeoutSeconds int `json:"pub_sub_timeout_seconds" validate:"required"`

	AssignedTreatmentLogger       config.AssignedTreatmentLoggerConfig `json:"assigned_treatment_logger"`
	DebugConfig                   config.DebugConfig                   `json:"debug_config"`
	DeploymentConfig              config.DeploymentConfig              `json:"deployment_config"`
	MessageQueueConfig            common_mq_config.MessageQueueConfig  `json:"message_queue_config"`
	ManagementService             config.ManagementServiceConfig       `json:"management_service"`
	MonitoringConfig              config.Monitoring                    `json:"monitoring_config"`
	SwaggerConfig                 config.SwaggerConfig                 `json:"swagger_config"`
	NewRelicConfig                newrelic.Config                      `json:"new_relic_config"`
	SentryConfig                  sentry.Config                        `json:"sentry_config"`
	ManagementServicePollerConfig config.ManagementServicePollerConfig `json:"management_service_poller_config"`
}

type Variable

type Variable struct {
	Name        string      `json:"name" validate:"required"`
	Field       string      `json:"field"`
	FieldSource FieldSource `json:"field_source" validate:"required,oneof=none header payload"`
}

Jump to

Keyboard shortcuts

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