config

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Overview

Package config contains the configuration for the API. It supports variables passed in via a YAML file or through the host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

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

AgentConfig contains the config fields for a system agent

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"`
	EmailClientPluginData    map[string]string `yaml:"email_client_plugin_data"`

	// Plugin Type
	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"`
	EmailClientPluginType    string `yaml:"email_client_plugin_type" env:"EMAIL_CLIENT_PLUGIN_TYPE"`

	EmailFooter string `yaml:"email_footer" env:"EMAIL_FOOTER"`

	// The external facing URL for the Phobos API
	PhobosAPIURL string `yaml:"phobos_api_url" env:"API_URL"`
	// The external facing URL for the Phobos Frontend UI
	PhobosUIURL string `yaml:"phobos_ui_url" env:"UI_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 HTTP server port. Defaults to 9000
	HTTPServerPort string `yaml:"http_server_port" env:"HTTP_SERVER_PORT"`

	// The GRPC server port. Defaults to 9010.
	GRPCServerPort string `yaml:"grpc_server_port" env:"GRPC_SERVER_PORT"`

	TokenIssuerURL string `yaml:"TOKEN_ISSUER_URL" env:"TOKEN_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"`

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

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

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

	InternalAgents []AgentConfig `yaml:"internal_agents"`

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

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

	OtelTraceCollectorPort int `yaml:"otel_trace_port" env:"OTEL_TRACE_PORT"`

	OtelTraceEnabled bool `yaml:"otel_trace_enabled" env:"OTEL_TRACE_ENABLED"`

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

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

	// Max upload size for GRPC template upload
	TemplateMaxUploadSize int64 `yaml:"template_max_upload_size" env:"TEMPLATE_MAX_UPLOAD_SIZE"`

	// Max upload size for GRPC plugin binary upload
	PluginBinaryMaxUploadSize int64 `yaml:"plugin_binary_max_upload_size" env:"PLUGIN_BINARY_MAX_UPLOAD_SIZE"`
}

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

Jump to

Keyboard shortcuts

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