config

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 13 Imported by: 4 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogLevel string

	UserAgent string
)

Functions

func SetLogLevel added in v0.31.0

func SetLogLevel(level logrus.Level)

func SetLogger added in v0.31.0

func SetLogger(l *logrus.Entry)

Types

type AIConfig added in v0.32.0

type AIConfig struct {
	Enabled            bool
	Provider           string            // "gemini" (default), "copilot", or "openai"
	Token              string            // Default token for configured Provider
	ClaudeToken        string            // API key for Anthropic Claude
	CopilotToken       string            // GitHub token for Copilot
	DeepSeekToken      string            // API key for DeepSeek
	GeminiToken        string            // API key for Google AI Studio
	HetznerToken       string            // API key for Hetzner
	MuseToken          string            // API key for Meta Muse
	OpenAIToken        string            // API key for OpenAI
	OpenRouterToken    string            // API key for OpenRouter
	XAIToken           string            // API key for xAI (Grok)
	URL                string            // Fallback base URL for configured Provider
	URLs               map[string]string // Provider-specific base URLs
	ServiceAccountFile string            // Gemini / Vertex AI
	Project            string
	Location           string
	Model              string            // Fallback model if not specified in Models map
	Models             map[string]string // Provider-specific models, e.g. { "gemini": "gemini-4-hydrogen", "copilot": "gpt-6-luna" }
	Prompt             string
	DefaultPostLimit   int
	MaxPostLimit       int
}

func (*AIConfig) GetBaseURL added in v0.35.0

func (c *AIConfig) GetBaseURL(provider string) string

GetBaseURL resolves the endpoint base URL for the requested provider, ensuring credentials and requests are not dispatched to unrelated endpoints.

func (*AIConfig) GetToken added in v0.35.0

func (c *AIConfig) GetToken(provider string) string

GetToken resolves the token for the requested provider, ensuring credentials do not cross provider or endpoint boundaries while preserving the legacy Copilot token fallback.

type BridgeConfig added in v0.31.0

type BridgeConfig struct {
	Restrict []string

	JoinOnly    []string
	JoinExclude []string
	JoinInclude []string
	JoinDM      bool

	ShowJoinPart   bool
	ShowOnlyJoined bool
	PartFake       bool

	// Threading / context related
	PrefixContext    bool
	SuffixContext    bool
	ThreadContext    string
	ShowContextMulti bool

	DirectoryURL string
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

func Load added in v0.31.0

func Load(cfgfile string, flags *pflag.FlagSet) (*Config, error)

func (*Config) AI added in v0.32.0

func (c *Config) AI() *AIConfig

func (*Config) Current added in v0.31.0

func (c *Config) Current() *RuntimeConfig

func (*Config) Mastodon added in v0.31.0

func (c *Config) Mastodon() *MastodonConfig

func (*Config) Matrix added in v0.35.0

func (c *Config) Matrix() *MatrixConfig

func (*Config) Mattermost added in v0.17.0

func (c *Config) Mattermost() *MattermostConfig

func (*Config) RegisterReloadHook added in v0.31.0

func (c *Config) RegisterReloadHook(hook func(rc *RuntimeConfig)) func()

RegisterReloadHook allows other packages to execute logic when the config file changes.

The returned function unregisters the hook again. A hook keeps everything it references alive, so hooks of things with a limited lifetime (like a login session) must be unregistered when that lifetime ends.

func (*Config) Reload added in v0.31.0

func (c *Config) Reload() error

Reload re-reads the config file, updates the atomic pointer, and triggers hooks.

func (*Config) Slack added in v0.17.0

func (c *Config) Slack() *SlackConfig

type FormatterConfig added in v0.31.0

type FormatterConfig struct {
	DisableEmoji bool
	CustomEmoji  map[string]string

	DisableMarkdown           bool
	DisableMarkdownBlockQuote bool
	MarkdownBlockQuoteChar    string
	MarkdownInlineCode        string

	SyntaxHighlighting     string
	DisableCodeBlockPrefix bool
	CodeBlockPrefix        string
	CodeBlockSeparator     string

	Unicode bool

	EnableIRCHexColors bool

	PreserveNewLines string
}

type GlobalConfig added in v0.31.0

type GlobalConfig struct {
	Bind string

	Debug         bool
	Trace         bool
	Gops          bool
	Profiling     bool
	ProfilingBind string

	TLSBind string
	TLSDir  string
	TLSKey  string
	TLSCert string

	HandshakeTimeout int
	ClientTimeout    int

	PasteBufferTimeout int

	HardLineSplit bool
	MaxLineLength int

	EnableTyping      bool
	DisableSendTyping bool
	ServerTime        bool

	AwayCooldown time.Duration
}

type MastodonConfig added in v0.31.0

type MastodonConfig struct {
	Bridge    BridgeConfig
	Formatter FormatterConfig

	Server string

	ClientID     string
	ClientSecret string
	AccessToken  string
}

type MatrixConfig added in v0.35.0

type MatrixConfig struct {
	SharedConfig

	Bridge    BridgeConfig
	Formatter FormatterConfig

	MatrixclientLogLevel string

	// DefaultProvider is left out of channel names, e.g. "ubuntu.com".
	DefaultProvider string

	// ReplaceColonChar separates localpart and homeserver in the nick of remote
	// users instead of Matrix's ':', e.g. "/" gives hloeung/matrix.org. The
	// special value "[]" gives hloeung[matrix.org].
	ReplaceColonChar string

	// Encrypted rooms, needs a build with -tags goolm and cgo.
	EncryptionDir       string
	EncryptionPickleKey string
}

type MattermostConfig added in v0.31.0

type MattermostConfig struct {
	SharedConfig

	Bridge    BridgeConfig
	Formatter FormatterConfig

	MatterclientLogLevel string

	DefaultServer string
	DefaultTeam   string

	Insecure            bool
	IgnoreServerVersion bool

	SkipTLSVerify bool

	PrefixMainTeam bool

	ForceAntiIdle    bool
	AntiIdleChannel  string
	AntiIdleInterval int

	ForceSyncOnReconnect bool
}

type RuntimeConfig added in v0.31.0

type RuntimeConfig struct {
	GlobalConfig

	AI AIConfig

	Mattermost MattermostConfig
	Slack      SlackConfig
	Mastodon   MastodonConfig
	Matrix     MatrixConfig
}

RuntimeConfig is immutable.

A new RuntimeConfig is constructed whenever the configuration is reloaded and atomically published. Callers must never modify it.

type SharedConfig added in v0.35.0

type SharedConfig struct {
	CollapseScrollback bool

	ShowOwnReactions bool

	HideReactions bool

	DisableShowOwnModified bool

	ShowMentions bool

	DisableDefaultMentions bool

	DisableAutoView bool
	ReplayStrategy  string
	EnableLazyJoin  bool
	LazyJoinExclude []string
	ReplayExclude   []string

	JoinReplayDuration        time.Duration
	MaxReplayDuration         time.Duration
	LazyJoinDuration          time.Duration
	HeavySyncThreshold        time.Duration
	DefaultDMOfflineThreshold time.Duration

	HideReplies      bool
	ShortenRepliesTo int

	MessageAttachmentShortFieldMaxLineLength int
	MessageAttachmentOmitFieldTitles         bool

	LastViewedSaveFile string
	PreferNickname     bool
}

SharedConfig holds the options that apply to the Mattermost, Matrix, and Slack bridges.

type SlackConfig added in v0.31.0

type SlackConfig struct {
	SharedConfig

	Bridge    BridgeConfig
	Formatter FormatterConfig

	Disable bool

	SlackclientLogLevel string

	DenyUsers        []string
	UseDisplayName   bool
	UseRealName      bool
	DefaultWorkspace string
}

Jump to

Keyboard shortcuts

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