config

package
v0.0.0-...-72f1ef6 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config manages server and repository configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages repository configurations.

func New

func New() *Manager

New creates a new config manager.

func (*Manager) CacheStats

func (m *Manager) CacheStats() (hits, misses int64)

CacheStats returns cache hit and miss statistics for monitoring performance.

func (*Manager) ChannelsForRepo

func (m *Manager) ChannelsForRepo(org, repo string) []string

ChannelsForRepo returns the Slack channels configured for a specific repo. It first checks explicit YAML configuration, then falls back to auto-discovery where a repo named "goose" would automatically map to channel "#goose".

func (*Manager) Config

func (m *Manager) Config(org string) (*RepoConfig, bool)

Config returns the configuration for a GitHub org.

func (*Manager) DailyRemindersEnabled

func (m *Manager) DailyRemindersEnabled(org string) bool

DailyRemindersEnabled returns whether daily reminders are enabled for an org.

func (*Manager) Domain

func (m *Manager) Domain(org string) string

Domain returns the email domain for GitHub-to-Slack user mapping for the given organization.

func (*Manager) InvalidateAllConfigs

func (m *Manager) InvalidateAllConfigs()

InvalidateAllConfigs removes all cached configurations. This can be useful during testing or major configuration changes.

func (*Manager) InvalidateConfig

func (m *Manager) InvalidateConfig(org string)

InvalidateConfig removes the cached configuration for a specific organization. This is used when .codeGROOVE repository events are received to ensure fresh config loading.

func (*Manager) IsChannelMuted

func (m *Manager) IsChannelMuted(org, channel string) bool

IsChannelMuted checks if a specific channel is muted for an org.

func (*Manager) LoadConfig

func (m *Manager) LoadConfig(ctx context.Context, org string) error

LoadConfig loads the configuration for a GitHub org with retry logic.

func (*Manager) ReloadConfig

func (m *Manager) ReloadConfig(ctx context.Context, org string) error

ReloadConfig reloads the configuration for an org (e.g., when .codeGROOVE repo is updated).

func (*Manager) ReminderDMDelay

func (m *Manager) ReminderDMDelay(org, channel string) int

ReminderDMDelay returns the follow-up reminder delay in minutes for a specific channel. Returns the channel-specific delay if set, otherwise the global delay (default: 65 minutes). A value of 0 means the feature is disabled.

func (*Manager) SetGitHubClient

func (m *Manager) SetGitHubClient(org string, client any)

SetGitHubClient sets the GitHub client for a specific org.

func (*Manager) SetWorkspaceName

func (m *Manager) SetWorkspaceName(workspaceName string)

SetWorkspaceName sets the Slack workspace name for validation.

func (*Manager) When

func (m *Manager) When(org, channel string) string

When returns the posting threshold for a channel. Returns "immediate" (default), "assigned", "blocked", or "passing".

func (*Manager) WorkspaceName

func (m *Manager) WorkspaceName(org string) string

WorkspaceName returns the Slack workspace team_id for an organization. Returns empty string if no workspace is configured.

type RepoConfig

type RepoConfig struct {
	Channels map[string]struct {
		ReminderDMDelay *int     `yaml:"reminder_dm_delay"`
		When            *string  `yaml:"when"`  // Optional: when to post threads ("immediate", "assigned", "blocked", "passing")
		Repos           []string `yaml:"repos"` // Optional: override global delay for this channel (0 = disabled)

		Mute bool `yaml:"mute"`
	} `yaml:"channels"`
	Users  map[string]string `yaml:"users"`
	Global struct {
		TeamID             string `yaml:"team_id"`
		EmailDomain        string `yaml:"email_domain"`
		ReminderDMDelay    int    `yaml:"reminder_dm_delay"`
		When               string `yaml:"when"`                 // When to post threads: "immediate" (default), "assigned", "blocked", "passing"
		DisableDailyReport bool   `yaml:"disable_daily_report"` // Default false (reports enabled)
	} `yaml:"global"` // Minutes to wait before sending DM if user tagged in channel (0 = disabled)
}

RepoConfig represents the slack.yaml configuration for a GitHub org.

type ServerConfig

type ServerConfig struct {
	DataDir               string
	SlackSigningSecret    string
	GitHubAppID           string
	GitHubPrivateKey      string
	SprinklerURL          string
	AllowPersonalAccounts bool // Allow processing GitHub personal accounts (default: false for DoS protection)
}

ServerConfig holds the server configuration from environment variables.

Jump to

Keyboard shortcuts

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