config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config handles loading and merging configuration from YAML files and environment variables. Configuration lives at ~/.autopilot/config.yaml by default and can be overridden per-field with environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDir

func DefaultDir() (string, error)

DefaultDir returns the default autopilot config directory (~/.autopilot).

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the default config file path.

Types

type Config

type Config struct {
	AnthropicKey string         `yaml:"anthropic_key"`
	Model        string         `yaml:"model"`
	DataDir      string         `yaml:"data_dir"`
	Discord      DiscordConfig  `yaml:"discord"`
	Telegram     TelegramConfig `yaml:"telegram"`
	Modules      map[string]any `yaml:"modules"`
	Schedule     ScheduleConfig `yaml:"schedule"`
}

Config is the top-level configuration for the autopilot agent.

func Load

func Load(path string) (*Config, error)

Load reads configuration from the given YAML file path, applies defaults, then merges any matching environment variables on top. If path is empty, it uses the default path (~/.autopilot/config.yaml). If the file does not exist, a default config is written and returned.

func (*Config) ModuleConfig

func (c *Config) ModuleConfig(name string) map[string]any

ModuleConfig extracts the configuration map for a specific module. Returns nil if the module has no configuration.

type DiscordConfig

type DiscordConfig struct {
	WebhookURL string `yaml:"webhook_url"`
	Enabled    bool   `yaml:"enabled"`
}

DiscordConfig holds settings for outbound Discord webhook notifications.

type ScheduleConfig

type ScheduleConfig struct {
	MorningBriefing string `yaml:"morning_briefing"`
	EveningDigest   string `yaml:"evening_digest"`
}

ScheduleConfig defines cron expressions for recurring agent tasks.

type TelegramConfig

type TelegramConfig struct {
	BotToken string `yaml:"bot_token"`
	ChatID   string `yaml:"chat_id"`
	Enabled  bool   `yaml:"enabled"`
}

TelegramConfig holds settings for the Telegram bot integration.

Jump to

Keyboard shortcuts

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