Documentation
¶
Overview ¶
Package agentconfig contains the configuration for abyss agents, including loading and validating it from YAML files.
Index ¶
- Constants
- func BuildAgentProxyArgs(cfg *AgentConfig) string
- type ACPConfig
- type AgentConfig
- type DockerConfig
- type FileCopyConfig
- type FileCopyType
- type HostMount
- type ImagePullPolicy
- type PluginConfig
- type PluginConfigOptions
- type SetupScriptType
- type SetupScriptsConfig
- type ToolsOnHostConfig
- type WebsocketConfig
Constants ¶
const ( DefaultTLSServerCertPath = "/etc/abyss/tls/server.crt" DefaultTLSServerKeyPath = "/etc/abyss/tls/server.key" DefaultTLSCACertPath = "/etc/abyss/tls/ca.crt" DefaultTLSClientCertPath = "/etc/abyss/tls/client.crt" DefaultTLSClientKeyPath = "/etc/abyss/tls/client.key" )
Default paths where the agent's TLS certificates are stored inside the agent container. The client certificate and key are also stored there so persistent containers can be reconnected to in later sessions.
const DefaultImage = "ghcr.io/sethcurry/abyss-pi:latest"
DefaultImage is the Docker image used when the agent config does not specify one.
const DefaultServerPort = 8080
DefaultServerPort is the container port the agent's API server listens on when the config does not specify one.
const DefaultStartFilePath = "/tmp/abyss.start"
DefaultStartFilePath is the path inside the agent container whose existence signals that the agent has finished starting up.
const WaitForStartFileSleepDuration = time.Second
WaitForStartFileSleepDuration is how long the client waits between checks for the start file to appear.
Variables ¶
This section is empty.
Functions ¶
func BuildAgentProxyArgs ¶ added in v0.0.2
func BuildAgentProxyArgs(cfg *AgentConfig) string
BuildAgentProxyArgs converts the configuration options from a *AgentConfig into a string containing the bash command to run to start the agent proxy inside the container.
Types ¶
type ACPConfig ¶
type ACPConfig struct {
ToolsOnHost ToolsOnHostConfig `yaml:"tools_on_host"`
}
ACPConfig is the root of the ACP-specific agent configuration.
type AgentConfig ¶
type AgentConfig struct {
Docker DockerConfig `yaml:"docker"`
SetupScripts []SetupScriptsConfig `yaml:"setup_scripts"`
CopyFiles []FileCopyConfig `yaml:"copy_files"`
ACP ACPConfig `yaml:"acp"`
Websocket WebsocketConfig `yaml:"websocket"`
Plugins PluginConfig `yaml:"plugins"`
}
AgentConfig stores the entirety of a single agent's configuration. Its 2 uses are:
- To be used in unmarshalling an agent config from YAML
- To validate that an unmarshalled config is valid via Validate()
func FromYAMLFile ¶
func FromYAMLFile(path string) (*AgentConfig, error)
FromYAMLFile reads the YAML file at the given path and unmarshals it into an *AgentConfig. Paths are not normalized, so ~ characters will not be expanded.
func (AgentConfig) Validate ¶ added in v0.0.2
func (a AgentConfig) Validate() error
Validate implements types.Validator by validating each nested config. Returns an error if any of its attributes return an error from their Validate function.
type DockerConfig ¶
type DockerConfig struct {
// The Docker image to use. Can be short or long, Docker will
// resolve it for short names.
Image string `yaml:"image"`
ImagePullPolicy ImagePullPolicy `yaml:"image_pull_policy"`
HostMounts []HostMount `yaml:"host_mounts"`
AgentCommand []string `yaml:"agent_command"`
// PersistentName controls whether a new container is created for each
// connection, or if the same container is left running and re-used.
// If empty, a new container is created for each connection.
PersistentName string `yaml:"persistent_name"`
}
DockerConfig holds the Docker-specific configuration for an agent.
func (DockerConfig) Validate ¶ added in v0.0.2
func (d DockerConfig) Validate() error
Validate implements types.Validator by checking the image and each host mount.
type FileCopyConfig ¶
type FileCopyConfig struct {
// Type is currently either "inline" or "path"
Type FileCopyType `yaml:"type"`
// Source is the content or file path of the source
Source string `yaml:"source"`
// Target is the destination path on the agent
Target string `yaml:"target"`
}
FileCopyConfig represents a file to be copied onto an agent, either with inline content or from a source path.
func (FileCopyConfig) Validate ¶ added in v0.0.2
func (f FileCopyConfig) Validate() error
Validate implements types.Validator by checking the source, target, and type.
type FileCopyType ¶
type FileCopyType string
FileCopyType is an enum type. It exists solely so UnmarshalYAML can validate the type field.
const ( // FileCopyTypeInline indicates the file's content is inlined in the config. FileCopyTypeInline FileCopyType = "inline" // FileCopyTypePath indicates the file's content is read from a path. FileCopyTypePath FileCopyType = "path" )
func (*FileCopyType) UnmarshalYAML ¶
func (t *FileCopyType) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML validates that the Type field is either "inline" or "path".
type ImagePullPolicy ¶ added in v0.0.2
type ImagePullPolicy string
ImagePullPolicy controls when Docker pulls the configured image.
const ( // ImagePullPolicyAlways always pulls the configured image. ImagePullPolicyAlways ImagePullPolicy = "Always" // ImagePullPolicyIfNotPresent pulls the image only when it is not // present locally. ImagePullPolicyIfNotPresent ImagePullPolicy = "IfNotPresent" // ImagePullPolicyNever never pulls the image. ImagePullPolicyNever ImagePullPolicy = "Never" )
func (ImagePullPolicy) Validate ¶ added in v0.0.2
func (p ImagePullPolicy) Validate() error
Validate implements types.Validator by rejecting values outside the allowed set. An empty value is treated as unset and is valid.
type PluginConfig ¶ added in v0.0.3
type PluginConfig struct {
Client []PluginConfigOptions `yaml:"client"`
}
PluginConfig stores configuration for all plugins.
type PluginConfigOptions ¶ added in v0.0.3
type PluginConfigOptions struct {
Path string `yaml:"path"`
}
PluginConfigOptions contains the config for a single plugin.
type SetupScriptType ¶
type SetupScriptType string
SetupScriptType is an enum type. It exists solely so UnmarshalYAML can validate the type field.
const ( // SetupScriptTypeFile loads the script from a file path. SetupScriptTypeFile SetupScriptType = "file" // SetupScriptTypeInline treats the source as inline script content. SetupScriptTypeInline SetupScriptType = "inline" )
The valid setup script types.
func (*SetupScriptType) UnmarshalYAML ¶
func (t *SetupScriptType) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML validates that the Type field is either "file" or "inline".
type SetupScriptsConfig ¶
type SetupScriptsConfig struct {
// Type is either "inline" or "file"
Type SetupScriptType `yaml:"type"`
// Source is the script content or file path
Source string `yaml:"source"`
}
SetupScriptsConfig represents a setup script defined in agent configuration.
func (SetupScriptsConfig) Validate ¶ added in v0.0.2
func (s SetupScriptsConfig) Validate() error
Validate implements types.Validator by checking the source and type. An empty type is allowed and treated as inline.
type ToolsOnHostConfig ¶
ToolsOnHostConfig holds the boolean flags that toggle the ACP tools that run on the host, such as file and terminal access.
func (ToolsOnHostConfig) Validate ¶ added in v0.0.2
func (t ToolsOnHostConfig) Validate() error
Validate implements types.Validator. There is nothing to validate for boolean flags.
type WebsocketConfig ¶ added in v0.0.2
type WebsocketConfig struct {
DisableTLS bool `yaml:"disable_tls"`
}
WebsocketConfig stores websocket-related configuration options like whether TLS is enabled or not.