config

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package config package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Plugin Data
	ObjectStorePluginData    map[string]string `yaml:"object_store_plugin_data"`
	RateLimitStorePluginData map[string]string `yaml:"rate_limit_store_plugin_data" env:"RATE_LIMIT_STORE_PLUGIN_DATA"`
	JWSProviderPluginData    map[string]string `yaml:"jws_provider_plugin_data"`

	// Plugin Typ
	ObjectStorePluginType    string `yaml:"object_store_plugin_type" env:"OBJECT_STORE_PLUGIN_TYPE"`
	RateLimitStorePluginType string `yaml:"rate_limit_store_plugin_type" env:"RATE_LIMIT_STORE_PLUGIN_TYPE"`
	JWSProviderPluginType    string `yaml:"jws_provider_plugin_type" env:"JWS_PROVIDER_PLUGIN_TYPE"`

	// The external facing URL for the Tharsis API
	TharsisAPIURL string `yaml:"tharsis_api_url" env:"API_URL"`

	TLSEnabled bool `yaml:"tls_enabled" env:"TLS_ENABLED"`

	TLSCertFile string `yaml:"tls_cert_file" env:"TLS_CERT_FILE"`

	TLSKeyFile string `yaml:"tls_key_file" env:"TLS_KEY_FILE"`

	// the server port. Defaults to 8000
	ServerPort string `yaml:"server_port" env:"SERVER_PORT"`

	ServiceAccountIssuerURL string `yaml:"service_account_issuer_url" env:"SERVICE_ACCOUNT_ISSUER_URL"`

	// the url for connecting to the database. required.
	DBHost     string `yaml:"db_host" env:"DB_HOST"`
	DBName     string `yaml:"db_name" env:"DB_NAME"`
	DBSSLMode  string `yaml:"db_ssl_mode" env:"DB_SSL_MODE"`
	DBUsername string `yaml:"db_username" env:"DB_USERNAME,secret"`
	DBPassword string `yaml:"db_password" env:"DB_PASSWORD,secret"`

	// TFE Login
	TFELoginClientID string `yaml:"tfe_login_client_id" env:"TFE_LOGIN_CLIENT_ID"`
	TFELoginScopes   string `yaml:"tfe_login_scopes" env:"TFE_LOGIN_SCOPES"`

	// ServiceDiscoveryHost is optional and will default to the API URL host if it's not defined
	ServiceDiscoveryHost string `yaml:"service_discovery_host" env:"SERVICE_DISCOVERY_HOST"`

	// AdminUserEmail is optional and will create a system admin user with this email.
	AdminUserEmail string `yaml:"admin_user_email" env:"ADMIN_USER_EMAIL"`

	// Otel
	OtelTraceType          string `yaml:"otel_trace_type" env:"OTEL_TRACE_TYPE"`
	OtelTraceCollectorHost string `yaml:"otel_trace_host" env:"OTEL_TRACE_HOST"`

	// TerraformCLIVersionConstraint is a comma-separated list of constraints used to limit the returned Terraform CLI versions.
	TerraformCLIVersionConstraint string `yaml:"terraform_cli_version_constraint" env:"TERRAFORM_CLI_VERSION_CONSTRAINT"`

	// The OIDC identity providers
	OauthProviders []IdpConfig `yaml:"oauth_providers"`

	InternalRunners []RunnerConfig `yaml:"internal_runners"`

	// Database Configuration
	DBMaxConnections int `yaml:"db_max_connections" env:"DB_MAX_CONNECTIONS"`
	DBPort           int `yaml:"db_port" env:"DB_PORT"`

	MaxGraphQLComplexity int `yaml:"max_graphql_complexity" env:"MAX_GRAPHQL_COMPLEXITY"`

	// Max upload size when uploading a module to the module registry
	ModuleRegistryMaxUploadSize int `yaml:"module_registry_max_upload_size" env:"MODULE_REGISTRY_MAX_UPLOAD_SIZE"`

	// Timout for async background tasks
	AsyncTaskTimeout int `yaml:"async_task_timeout" env:"ASYNC_TASK_TIMEOUT"`

	// VCS repository size limit
	VCSRepositorySizeLimit int `yaml:"vcs_repository_size_limit" env:"VCS_REPOSITORY_SIZE_LIMIT"`

	// HTTP rate limit value
	HTTPRateLimit int `yaml:"http_rate_limit" env:"HTTP_RATE_LIMIT"`

	OtelTraceCollectorPort int  `yaml:"otel_trace_port" env:"OTEL_TRACE_PORT"`
	OtelTraceEnabled       bool `yaml:"otel_trace_enabled" env:"OTEL_TRACE_ENABLED"`

	// Enable TFE
	TFELoginEnabled bool `yaml:"tfe_login_enabled" env:"TFE_LOGIN_ENABLED"`

	// Whether to auto migrate the database
	DBAutoMigrateEnabled bool `yaml:"db_auto_migrate_enabled" env:"DB_AUTO_MIGRATE_ENABLED"`
}

Config represents an application configuration.

func Load

func Load(file string, logger logger.Logger) (*Config, error)

Load returns an application configuration which is populated from the given configuration file and environment variables.

func (Config) Validate

func (c Config) Validate() error

Validate validates the application configuration.

type IdpConfig

type IdpConfig struct {
	IssuerURL     string `yaml:"issuer_url"`
	ClientID      string `yaml:"client_id"`
	UsernameClaim string `yaml:"username_claim"`
	Scope         string `yaml:"scope"`
	LogoutURL     string `yaml:"logout_url"`
}

IdpConfig contains the config fields for an Identity Provider

type RunnerConfig added in v0.8.0

type RunnerConfig struct {
	JobDispatcherData map[string]string `yaml:"job_dispatcher_data"`
	Name              string            `yaml:"name"`
	JobDispatcherType string            `yaml:"job_dispatcher_type"`
}

RunnerConfig contains the config fields for a system runner

Jump to

Keyboard shortcuts

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