config

package
Version: v0.0.0-...-ceb5cd5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertConfig

type AlertConfig struct {
	Enabled bool          `default:"false"`
	GitLab  *GitlabConfig `envconfig:"gitlab"`
}

type AuthorizationConfig

type AuthorizationConfig struct {
	Enabled bool `default:"true"`
	URL     string
}

AuthorizationConfig captures the config for auth using mlp authz

type Config

type Config struct {
	Port                int                  `envconfig:"turing_port" default:"8080"`
	AuthConfig          *AuthorizationConfig `envconfig:"authorization" validate:"required"`
	DbConfig            *DatabaseConfig      `envconfig:"turing_database"`
	DeployConfig        *DeploymentConfig    `envconfig:"deployment"`
	RouterDefaults      *RouterDefaults      `envconfig:"turing_router"`
	Sentry              sentry.Config        `split_words:"false" envconfig:"SENTRY"`
	VaultConfig         *VaultConfig         `envconfig:"vault"`
	TuringEncryptionKey string               `split_words:"true" required:"true"`
	AlertConfig         *AlertConfig         `envconfig:"alert"`
	MLPConfig           *MLPConfig
	TuringUIConfig      *TuringUIConfig `envconfig:"turing_ui"`
	// SwaggerFile specifies the file path containing OpenAPI spec. This file will be used to configure
	// OpenAPI validation middleware, which validates HTTP requests against the spec.
	SwaggerFile string `envconfig:"swagger_file" default:"swagger.yaml"`
}

Config is used to parse and store the environment configs

func FromEnv

func FromEnv() (*Config, error)

FromEnv loads the configs from the supplied environment

func (*Config) ListenAddress

func (c *Config) ListenAddress() string

ListenAddress returns the Turing Api app's port

type DatabaseConfig

type DatabaseConfig struct {
	Host     string `required:"true"`
	Port     int    `default:"5432"`
	User     string `required:"true"`
	Password string `required:"true"`
	Database string `envconfig:"name" required:"true"`
}

DatabaseConfig config captures the Turing database config

type DeploymentConfig

type DeploymentConfig struct {
	EnvironmentType string        `envconfig:"environment_type" required:"true"`
	GcpProject      string        `envconfig:"gcp_project" required:"true"`
	Timeout         time.Duration `required:"true"`
	DeletionTimeout time.Duration `envconfig:"deletion_timeout" required:"true"`
	MaxCPU          Quantity      `envconfig:"max_cpu" required:"true"`
	MaxMemory       Quantity      `envconfig:"max_memory" required:"true"`
}

DeploymentConfig captures the config related to the deployment of the turing routers

type FluentdConfig

type FluentdConfig struct {
	// Image to use for fluentd deployments, in the format registry/repository:version.
	Image string `split_words:"true" required:"true"`
	// Fluentd tag for logs
	Tag string `split_words:"true" default:"turing-result.log"`
	// Flush interval seconds - value determined by load job frequency to BQ
	FlushIntervalSeconds int `split_words:"true" default:"90"`
}

FluentdConfig captures the defaults used by the Turing Router when Fluentd is enabled

type GitlabConfig

type GitlabConfig struct {
	BaseURL    string
	Token      string
	ProjectID  string
	Branch     string `default:"master"`
	PathPrefix string `default:"turing"`
}

type MLPConfig

type MLPConfig struct {
	MerlinURL        string `envconfig:"merlin_url" required:"true"`
	MLPURL           string `envconfig:"mlp_url" required:"true"`
	MLPEncryptionKey string `envconfig:"mlp_encryption_key" required:"true"`
}

MLPConfig captures the configuration used to connect to the Merlin/MLP API servers

type Quantity

type Quantity resource.Quantity

Quantity is an alias for resource.Quantity

func (*Quantity) Decode

func (qty *Quantity) Decode(value string) (err error)

Decode parses the Quantity config and checks that it is non-empty and can be converted into a valid resource.Quantity.

type RouterDefaults

type RouterDefaults struct {
	// Turing router image, in the format registry/repository:version.
	Image string `required:"true"`
	// Enable Fiber debug logging
	FiberDebugLogEnabled bool `split_words:"true" default:"true"`
	// Enable router custom metrics
	CustomMetricsEnabled bool `split_words:"true" default:"true"`
	// Enable Jaeger Tracing
	JaegerEnabled bool `split_words:"true" default:"true"`
	// Jaeger collector endpoint. If JaegerEnabled is true, this value
	// must be set.
	JaegerCollectorEndpoint string `split_words:"true" required:"true"`
	// Router log level
	LogLevel string `split_words:"true" default:"INFO"`
	// Fluentd config for the router
	FluentdConfig *FluentdConfig `envconfig:"fluentd"`
}

RouterDefaults contains default configuration for routers deployed by this isntance of the Turing API.

type TuringUIConfig

type TuringUIConfig struct {
	// Optional. If configured, turing-api will serve static files of the turing-ui React app
	AppDirectory string `envconfig:"app_directory"`
	// Optional. Defines the relative path under which the app will be accessible.
	// This should match `homepage` value from the `package.json` file of the CRA app
	Homepage string `default:"/turing"`
}

TuringUIConfig captures config related to serving Turing UI files

type VaultConfig

type VaultConfig struct {
	Address string `required:"true"`
	Token   string `required:"true"`
}

VaultConfig captures the config for connecting to the Vault server

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL