config

package
v3.17.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFlagName = "config"
	LevelFlagName  = "level"
)

Note: The application uses viper for configuration management. Viper merges configurations from various sources such as files, environment variables, and command line flags. After merging, viper unmarshals the configuration into the Configuration struct, which is then used throughout the application.

Variables

This section is empty.

Functions

func SystemShell added in v3.16.0

func SystemShell() string

Types

type AppConfig added in v3.14.3

type AppConfig struct {
	// embedded config
	*Config

	// application specific configuration
	AppName string
	V       *viper.Viper
}

func NewAppConfig added in v3.14.3

func NewAppConfig(appName string, opts ...AppConfigOption) (*AppConfig, error)

NewAppConfig creates a new AppConfig and applies any provided options.

func (*AppConfig) AddIAMPolicyBinding added in v3.16.6

func (ac *AppConfig) AddIAMPolicyBinding(role string, memberExpr string) (bool, error)

AddIAMPolicyBinding adds an IAM policy binding to the config file. It uses kyaml to preserve unrecognized sections in the YAML.

func (*AppConfig) ConfigDirName added in v3.14.3

func (ac *AppConfig) ConfigDirName() string

ConfigDirName returns the name of the configuration directory.

func (*AppConfig) DefaultConfigFile added in v3.14.3

func (ac *AppConfig) DefaultConfigFile() string

func (*AppConfig) GetConfig added in v3.14.3

func (ac *AppConfig) GetConfig() *Config

GetConfig returns a configuration created from the viper configuration.

func (*AppConfig) GetConfigDir added in v3.14.3

func (ac *AppConfig) GetConfigDir() string

GetConfigDir returns the full path to the configuration directory

func (*AppConfig) GetConfigFile added in v3.14.3

func (ac *AppConfig) GetConfigFile() string

GetConfigFile returns the configuration file

func (*AppConfig) GetLogDir added in v3.14.3

func (ac *AppConfig) GetLogDir() string

func (*AppConfig) UpdateViperConfig added in v3.14.3

func (ac *AppConfig) UpdateViperConfig(expression string) (*Config, error)

UpdateViperConfig update the viper configuration with the given expression. expression should be a value such as "agent.model=gpt-4o-mini" The input is a viper configuration because we leverage viper to handle setting most keys. However, in some special cases we use custom functions. This is why we return a Config object.

type AppConfigOption added in v3.14.3

type AppConfigOption func(*AppConfig) error

AppConfigOption is a functional option for configuring AppConfig.

func WithViper added in v3.14.3

func WithViper(cmd *cobra.Command) AppConfigOption

WithViperCmd binds the config flag to the command line flags.

func WithViperInstance added in v3.14.3

func WithViperInstance(v *viper.Viper, cmd *cobra.Command) AppConfigOption

WithViper allows setting a custom viper instance in AppConfig.

type AssistantServerConfig

type AssistantServerConfig struct {
	// BindAddress is the address to bind to. Default is 0.0.0.0
	BindAddress string `json:"bindAddress" yaml:"bindAddress"`

	// Port is the port for the server
	Port int `json:"port" yaml:"port"`

	// HttpMaxReadTimeout is the max read duration.
	// Ref: https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts
	HttpMaxReadTimeout time.Duration `json:"httpMaxReadTimeout" yaml:"httpMaxReadTimeout"`

	// HttpMaxWriteTimeout is the max write duration.
	HttpMaxWriteTimeout time.Duration `json:"httpMaxWriteTimeout" yaml:"httpMaxWriteTimeout"`

	// CorsOrigins is a list of allowed origins for CORS requests.
	CorsOrigins []string `json:"corsOrigins" yaml:"corsOrigins"`

	// StaticAssets is an optional directory containing a web application to serve.
	// The directory must contain an index.html file.
	StaticAssets string `json:"staticAssets" yaml:"staticAssets"`

	// Deprecated: retained temporarily so existing configuration files continue
	// to load. The server ignores this setting.
	AgentService *bool `json:"agentService,omitempty" yaml:"agentService,omitempty"`

	// RunnerService starts the Runme runner service if true otherwise it doesn't start the runner service.
	RunnerService bool `json:"runnerService" yaml:"runnerService"`

	// RunnerReconnect is a flag to enable automatic reconnecting to the runner from the frontend.
	RunnerReconnect bool `json:"runnerReconnect,omitempty" yaml:"runnerReconnect,omitempty"`

	// ParserService starts the Runme parser service if true otherwise it doesn't start the parser service.
	ParserService bool `json:"parserService" yaml:"parserService"`

	// OIDC configuration
	OIDC *OIDCConfig `json:"oidc,omitempty" yaml:"oidc,omitempty"`

	// TLSConfig is the TLS configuration
	TLSConfig *TLSConfig `json:"tlsConfig,omitempty" yaml:"tlsConfig,omitempty"`

	// Deprecated: retained temporarily so existing configuration files continue
	// to load. The server no longer serves or redirects to the web application.
	WebAppURL string `json:"webAppURL" yaml:"webAppURL"`
}

func (*AssistantServerConfig) GetAgentService deprecated added in v3.16.6

func (c *AssistantServerConfig) GetAgentService() bool

GetAgentService returns the legacy agent service setting.

Deprecated: the server ignores this setting.

func (*AssistantServerConfig) GetBindAddress

func (c *AssistantServerConfig) GetBindAddress() string

func (*AssistantServerConfig) GetHttpMaxReadTimeout

func (c *AssistantServerConfig) GetHttpMaxReadTimeout() time.Duration

func (*AssistantServerConfig) GetHttpMaxWriteTimeout

func (c *AssistantServerConfig) GetHttpMaxWriteTimeout() time.Duration

func (*AssistantServerConfig) GetPort

func (c *AssistantServerConfig) GetPort() int

type CloudAssistantConfig deprecated

type CloudAssistantConfig struct {
	VectorStores []string `json:"vectorStores,omitempty" yaml:"vectorStores,omitempty"`
	AgentCookie  string   `json:"agentCookie,omitempty" yaml:"agentCookie,omitempty"`
	TargetURL    string   `json:"targetUrl,omitempty" yaml:"targetUrl,omitempty"`
	Model        string   `json:"model,omitempty" yaml:"model,omitempty"`
}

CloudAssistantConfig is retained for configuration compatibility.

Deprecated: the server ignores this configuration.

type Config

type Config struct {
	APIVersion string           `json:"apiVersion" yaml:"apiVersion" yamltags:"required"`
	Kind       string           `json:"kind" yaml:"kind" yamltags:"required"`
	Metadata   api.Metadata     `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Logging    Logging          `json:"logging" yaml:"logging"`
	Telemetry  *TelemetryConfig `json:"telemetry,omitempty" yaml:"telemetry,omitempty"`

	// Deprecated: retained temporarily so existing configuration files continue
	// to load. The server ignores this configuration.
	OpenAI *OpenAIConfig `json:"openai,omitempty" yaml:"openai,omitempty"`

	// Deprecated: retained temporarily so existing configuration files continue
	// to load. The server ignores this configuration.
	CloudAssistant *CloudAssistantConfig `json:"cloudAssistant,omitempty" yaml:"cloudAssistant,omitempty"`

	AssistantServer *AssistantServerConfig `json:"assistantServer,omitempty" yaml:"assistantServer,omitempty"`

	// Deprecated: retained temporarily so existing configuration files continue
	// to load. The independently hosted web application no longer reads
	// configuration from this server.
	WebApp *agentv1.WebAppConfig `json:"webApp,omitempty" yaml:"webApp,omitempty"`

	// IAMPolicy is the IAM policy for the service. It only matters if OIDC is enabled in the AssistantServerConfig.
	IAMPolicy *api.IAMPolicy `json:"iamPolicy,omitempty" yaml:"iamPolicy,omitempty"`
	// contains filtered or unexported fields
}

Config represents the persistent configuration data.

Currently, the format of the data on disk and in memory is identical. In the future, we may modify this to simplify changes to the disk format and to store in-memory values that should not be written to disk. Could that be achieved by embedding it in a different struct which contains values that shouldn't be serialized?

func (*Config) DeepCopy

func (c *Config) DeepCopy() Config

DeepCopy returns a deep copy.

func (*Config) DeprecatedAgentConfigKeys deprecated added in v3.17.3

func (c *Config) DeprecatedAgentConfigKeys() []string

DeprecatedAgentConfigKeys returns deprecated agent configuration keys.

Deprecated: use DeprecatedConfigKeys to include all ignored compatibility fields.

func (*Config) DeprecatedConfigKeys added in v3.17.3

func (c *Config) DeprecatedConfigKeys() []string

DeprecatedConfigKeys returns legacy configuration keys that were explicitly provided but are no longer used by the server.

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() string

func (*Config) IsValid

func (c *Config) IsValid() []string

IsValid validates the configuration and returns any errors.

func (*Config) UseHoneycomb

func (c *Config) UseHoneycomb() bool

func (*Config) Write

func (c *Config) Write(cfgFile string) error

Write saves the configuration to a file.

type GenericOIDCConfig

type GenericOIDCConfig struct {
	// ClientID is the OAuth2 client ID
	ClientID string `json:"clientID" yaml:"clientID"`
	// ClientSecret is the OAuth2 client secret
	ClientSecret string `json:"clientSecret" yaml:"clientSecret"`
	// RedirectURL is the URL to redirect users to after login
	RedirectURL string `json:"redirectURL" yaml:"redirectURL"`
	// DiscoveryURL is the URL for the OpenID Connect discovery document
	DiscoveryURL string `json:"discoveryURL" yaml:"discoveryURL"`
	// Scopes are the OAuth2 scopes to request (optional, defaults to ["openid", "email"])
	Scopes []string `json:"scopes" yaml:"scopes"`
	// Issuer allows overwriting the URL for the OpenID Connect issuer
	Issuer string `json:"issuer" yaml:"issuer"`
}

GenericOIDCConfig contains configuration for a generic OIDC provider

func (*GenericOIDCConfig) GetDiscoveryURL

func (c *GenericOIDCConfig) GetDiscoveryURL() string

GetDiscoveryURL returns the discovery URL for the generic OIDC provider

type GoogleOIDCConfig

type GoogleOIDCConfig struct {
	// ClientCredentialsFile is the path to the file containing the Google client credentials
	// You only need this if doing the OAuth Login flow on the server.
	// If your just validating credentials you just need to provide ClientID string
	// TODO(jlewi): This feels kludgy and confusing? Can we clean up configuration to more cleanly specify
	// values in cases where we are just validating credentials vs minting tokens in the server?
	ClientCredentialsFile string `json:"clientCredentialsFile" yaml:"clientCredentialsFile"`
	ClientID              string `json:"clientID" yaml:"clientID"`

	// DiscoveryURL is the URL for the OpenID Connect discovery document.
	// If empty, defaults to Google's standard discovery URL.
	DiscoveryURL string `json:"discoveryURL" yaml:"discoveryURL"`
}

GoogleOIDCConfig contains Google-specific OIDC configuration

func (*GoogleOIDCConfig) GetDiscoveryURL

func (c *GoogleOIDCConfig) GetDiscoveryURL() string

Add a helper method to get the discovery URL with a default

type HoneycombConfig

type HoneycombConfig struct {
	// APIKeyFile is the Honeycomb API key
	APIKeyFile string `json:"apiKeyFile" yaml:"apiKeyFile"`
}

type LogFields

type LogFields struct {
	Level   string `json:"level,omitempty" yaml:"level,omitempty"`
	Time    string `json:"time,omitempty" yaml:"time,omitempty"`
	Message string `json:"message,omitempty" yaml:"message,omitempty"`
}

LogFields is the fields to use when logging to structured logging

type LogSink

type LogSink struct {
	// Set to true to write logs in JSON format
	JSON bool `json:"json,omitempty" yaml:"json,omitempty"`
	// Path is the path to write logs to. Use "stderr" to write to stderr.
	// Use gcplogs:///projects/${PROJECT}/logs/${LOGNAME} to write to Google Cloud Logging
	Path string `json:"path,omitempty" yaml:"path,omitempty"`
}

type Logging

type Logging struct {
	Level string `json:"level,omitempty" yaml:"level,omitempty"`
	// Use JSON logging
	JSON bool `json:"json,omitempty" yaml:"json,omitempty"`

	LogDir string `json:"logDir,omitempty" yaml:"logDir,omitempty"`
	// Sinks is a list of sinks to write logs to.
	// Use stderr to write to stderr.
	// Use gcplogs:///projects/${PROJECT}/logs/${LOGNAME} to write to Google Cloud Logging
	Sinks []LogSink `json:"sinks,omitempty" yaml:"sinks,omitempty"`

	LogFields *LogFields `json:"logFields,omitempty" yaml:"logFields,omitempty"`
}

type OIDCConfig

type OIDCConfig struct {
	// Google contains Google-specific OIDC configuration
	Google *GoogleOIDCConfig `json:"google,omitempty" yaml:"google,omitempty"`

	// Generic contains generic OIDC configuration
	Generic *GenericOIDCConfig `json:"generic,omitempty" yaml:"generic,omitempty"`

	// ForceApproval is a flag to force the user to approve the app again
	ForceApproval bool `json:"forceApproval" yaml:"forceApproval"`

	// ClientExchange if set to true the token exchange will happen on the client and not the server.
	// The server callback will just be used to load the appropriate page in the SPA.
	ClientExchange bool `json:"clientExchange" yaml:"clientExchange"`
}

OIDCConfig contains configuration for OIDC authentication

type OpenAIConfig deprecated

type OpenAIConfig struct {
	APIKeyFile   string `json:"apiKeyFile,omitempty" yaml:"apiKeyFile,omitempty"`
	Organization string `json:"organization,omitempty" yaml:"organization,omitempty"`
	Project      string `json:"project,omitempty" yaml:"project,omitempty"`
}

OpenAIConfig is retained for configuration compatibility.

Deprecated: the server ignores this configuration.

type TLSConfig

type TLSConfig struct {
	// Generate is a flag to generate a self-signed certificate if true.
	// If CertFile and KeyFile are also specified then the key is only generated if one doesn't already exist
	Generate bool `json:"generate" yaml:"generate"`

	// CertFile is the path to the TLS certificate file
	CertFile string `json:"certFile" yaml:"certFile"`
	// KeyFile is the path to the TLS key file
	KeyFile string `json:"keyFile" yaml:"keyFile"`
}

type TelemetryConfig

type TelemetryConfig struct {
	Honeycomb *HoneycombConfig `json:"honeycomb,omitempty" yaml:"honeycomb,omitempty"`
	// OtlpHTTPEndpoint is the endpoint for OTLP HTTP exporter (e.g., "localhost:4318").
	OtlpHTTPEndpoint string `json:"otlpHttpEndpoint,omitempty" yaml:"otlpHttpEndpoint,omitempty"`
}

Jump to

Keyboard shortcuts

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