config

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigEnv           = "DISCRAWL_CONFIG"
	DefaultTokenEnv            = "DISCORD_BOT_TOKEN"
	DefaultTokenKeyringService = "discrawl"
	DefaultTokenKeyringAccount = "discord_bot_token"
)

Variables

This section is empty.

Functions

func EnsureRuntimeDirs

func EnsureRuntimeDirs(cfg Config) error

func ExpandPath

func ExpandPath(path string) (string, error)

func NormalizeBotToken

func NormalizeBotToken(raw string) string

func ResolvePath

func ResolvePath(flagPath string) string

func Write

func Write(path string, cfg Config) error

Types

type Config

type Config struct {
	Version        int           `toml:"version"`
	GuildID        string        `toml:"guild_id,omitempty"`
	DefaultGuildID string        `toml:"default_guild_id,omitempty"`
	GuildIDs       []string      `toml:"guild_ids,omitempty"`
	DBPath         string        `toml:"db_path"`
	CacheDir       string        `toml:"cache_dir"`
	LogDir         string        `toml:"log_dir"`
	Discord        DiscordConfig `toml:"discord"`
	Desktop        DesktopConfig `toml:"desktop"`
	Sync           SyncConfig    `toml:"sync"`
	Search         SearchConfig  `toml:"search"`
	Share          ShareConfig   `toml:"share"`
}

func Default

func Default() Config

func Load

func Load(path string) (Config, error)

func (Config) AttachmentMediaEnabled added in v0.8.0

func (c Config) AttachmentMediaEnabled() bool

func (Config) AttachmentTextEnabled

func (c Config) AttachmentTextEnabled() bool

func (Config) EffectiveDefaultGuildID

func (c Config) EffectiveDefaultGuildID() string

func (*Config) Normalize

func (c *Config) Normalize() error

func (Config) SearchGuildDefaults

func (c Config) SearchGuildDefaults() []string

func (Config) ShareEnabled

func (c Config) ShareEnabled() bool

func (Config) ShareMediaEnabled added in v0.8.0

func (c Config) ShareMediaEnabled() bool

type DesktopConfig

type DesktopConfig struct {
	Path         string `toml:"path"`
	MaxFileBytes int64  `toml:"max_file_bytes"`
	FullCache    bool   `toml:"full_cache"`
}

type DiscordConfig

type DiscordConfig struct {
	TokenSource         string `toml:"token_source"`
	TokenEnv            string `toml:"token_env"`
	TokenKeyringService string `toml:"token_keyring_service"`
	TokenKeyringAccount string `toml:"token_keyring_account"`
}

type EmbeddingsConfig

type EmbeddingsConfig struct {
	Enabled        bool   `toml:"enabled"`
	Provider       string `toml:"provider"`
	Model          string `toml:"model"`
	BaseURL        string `toml:"base_url"`
	APIKeyEnv      string `toml:"api_key_env"`
	BatchSize      int    `toml:"batch_size"`
	MaxInputChars  int    `toml:"max_input_chars"`
	RequestTimeout string `toml:"request_timeout"`
}

type SearchConfig

type SearchConfig struct {
	DefaultMode string           `toml:"default_mode"`
	Embeddings  EmbeddingsConfig `toml:"embeddings"`
}

type ShareConfig

type ShareConfig struct {
	Remote     string            `toml:"remote,omitempty"`
	RepoPath   string            `toml:"repo_path,omitempty"`
	Branch     string            `toml:"branch,omitempty"`
	AutoUpdate bool              `toml:"auto_update"`
	StaleAfter string            `toml:"stale_after"`
	Media      *bool             `toml:"media"`
	Filter     ShareFilterConfig `toml:"filter"`
}

type ShareFilterConfig added in v0.7.1

type ShareFilterConfig struct {
	PublicOnly        bool     `toml:"public_only"`
	IncludeChannelIDs []string `toml:"include_channel_ids,omitempty"`
	ExcludeChannelIDs []string `toml:"exclude_channel_ids,omitempty"`
}

type SyncConfig

type SyncConfig struct {
	Source             string `toml:"source"`
	Concurrency        int    `toml:"concurrency"`
	RepairEvery        string `toml:"repair_every"`
	FullHistory        bool   `toml:"full_history"`
	AttachmentText     *bool  `toml:"attachment_text"`
	AttachmentMedia    *bool  `toml:"attachment_media"`
	MaxAttachmentBytes int64  `toml:"max_attachment_bytes"`
}

type TokenResolution

type TokenResolution struct {
	Token  string
	Source string
	Path   string
}

func ResolveDiscordToken

func ResolveDiscordToken(cfg Config) (TokenResolution, error)

Jump to

Keyboard shortcuts

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