config

package
v0.0.0-...-6cc63a5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignedTreatmentLoggerConfig

type AssignedTreatmentLoggerConfig struct {
	Kind                 AssignedTreatmentLoggerKind `json:"kind" default:""`
	QueueLength          int                         `json:"queue_length" default:"100"`
	FlushIntervalSeconds int                         `json:"flush_interval_seconds" default:"1"`

	BQConfig    *BigqueryConfig `json:"bq_config"`
	KafkaConfig *KafkaConfig    `json:"kafka_config"`
}

type AssignedTreatmentLoggerKind

type AssignedTreatmentLoggerKind = string
const (
	KafkaLogger AssignedTreatmentLoggerKind = "kafka"
	BQLogger    AssignedTreatmentLoggerKind = "bq"
	NoopLogger  AssignedTreatmentLoggerKind = ""
)

type BigqueryConfig

type BigqueryConfig struct {
	Project string `json:"project"`
	Dataset string `json:"dataset"`
	Table   string `json:"table"`
}

type Config

type Config struct {
	Port       int      `json:"port" default:"8080" validate:"required"`
	ProjectIds []string `json:"project_ids" default:""`

	AssignedTreatmentLogger AssignedTreatmentLoggerConfig       `json:"assigned_treatment_logger"`
	DebugConfig             DebugConfig                         `json:"debug_config" validate:"required,dive"`
	NewRelicConfig          newrelic.Config                     `json:"new_relic_config"`
	SentryConfig            sentry.Config                       `json:"sentry_config"`
	DeploymentConfig        DeploymentConfig                    `json:"deployment_config" validate:"required,dive"`
	MessageQueueConfig      common_mq_config.MessageQueueConfig `json:"message_queue_config" validate:"required,dive"`
	ManagementService       ManagementServiceConfig             `json:"management_service" validate:"required,dive"`
	MonitoringConfig        Monitoring                          `json:"monitoring_config"`
	SwaggerConfig           SwaggerConfig                       `json:"swagger_config" validate:"required,dive"`
	SegmenterConfig         map[string]interface{}              `json:"segmenter_config"`
}

func Load

func Load(filepaths ...string) (*Config, error)

func (*Config) GetProjectIds

func (c *Config) GetProjectIds() []models.ProjectId

func (*Config) ListenAddress

func (c *Config) ListenAddress() string

ListenAddress returns the Treatment API app's port

type DebugConfig

type DebugConfig struct {
	OutputPath string `json:"output_path" default:"/tmp" validate:"required"`
}

type DeploymentConfig

type DeploymentConfig struct {
	EnvironmentType                    string `json:"environment_type" default:"local" validate:"required"`
	MaxGoRoutines                      int    `json:"max_go_routines" default:"100" validate:"required"`
	GoogleApplicationCredentialsEnvVar string `json:"google_application_credentials_env_var"`
}

DeploymentConfig captures the config related to the deployment of Treatment Service

type KafkaConfig

type KafkaConfig struct {
	Brokers          string `json:"brokers"`
	Topic            string `json:"topics"`
	MaxMessageBytes  int    `json:"max_message_bytes" default:"1048588"`
	CompressionType  string `json:"compression_type" default:"none"`
	ConnectTimeoutMS int    `json:"connect_timeout_ms" default:"1000"`
}

type ManagementServiceConfig

type ManagementServiceConfig struct {
	URL                  string `json:"url" default:"http://localhost:3000/v1" validate:"required"`
	AuthorizationEnabled bool   `json:"authorization_enabled"`
}

type MetricSinkKind

type MetricSinkKind = string
const (
	RPCMetricSink        MetricSinkKind = "rpc"
	PrometheusMetricSink MetricSinkKind = "prometheus"
	NoopMetricSink       MetricSinkKind = ""
)

type Monitoring

type Monitoring struct {
	Kind         MetricSinkKind `json:"kind" default:"" validate:"required"`
	MetricLabels []string       `json:"metric_labels" default:""`
}

type SwaggerConfig

type SwaggerConfig struct {
	Enabled          bool     `json:"enabled" default:"false"`
	AllowedOrigins   []string `json:"allowed_origins" default:"*"`
	OpenAPISpecsPath string   `json:"open_api_specs_path" default:"."`
}

Jump to

Keyboard shortcuts

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