config

package
v0.0.0-...-229e418 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: GPL-3.0 Imports: 13 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 ChannelConfig

type ChannelConfig struct {
	ReminderDMDelay *int     `yaml:"reminder_dm_delay"`
	When            *string  `yaml:"when"`
	Type            string   `yaml:"type"`
	Repos           []string `yaml:"repos"`
	Mute            bool     `yaml:"mute"`
}

ChannelConfig holds per-channel settings.

type DiscordConfig

type DiscordConfig struct {
	Channels map[string]ChannelConfig `yaml:"channels"`
	Users    map[string]string        `yaml:"users"` // GitHub username -> Discord ID
	Global   GlobalConfig             `yaml:"global"`
}

DiscordConfig represents the discord.yaml configuration for a GitHub org.

func (*DiscordConfig) UserMappings

func (c *DiscordConfig) UserMappings() map[string]string

UserMappings returns the user mappings (for reverse lookup interface).

type GlobalConfig

type GlobalConfig struct {
	GuildID         string `yaml:"guild_id"`
	When            string `yaml:"when"`
	ReminderDMDelay int    `yaml:"reminder_dm_delay"`
}

GlobalConfig holds global settings for the org.

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 statistics.

func (*Manager) ChannelType

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

ChannelType returns the channel type ("forum" or "text").

func (*Manager) ChannelsForRepo

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

ChannelsForRepo returns the Discord channels configured for a specific repo.

func (*Manager) Config

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

Config returns the configuration for a GitHub org.

func (*Manager) DiscordUserID

func (m *Manager) DiscordUserID(org, githubUsername string) string

DiscordUserID returns the mapped Discord ID for a GitHub username.

func (*Manager) GuildID

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

GuildID returns the guild ID for an organization.

func (*Manager) LoadConfig

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

LoadConfig loads discord.yaml 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.

func (*Manager) ReminderDMDelay

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

ReminderDMDelay returns the DM delay in minutes for a channel.

func (*Manager) SetGitHubClient

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

SetGitHubClient sets the GitHub client for a specific org.

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".

type ServerConfig

type ServerConfig struct {
	GitHubAppID           string
	GitHubPrivateKey      string
	SprinklerURL          string
	TurnURL               string
	DiscordBotToken       string
	GCPProject            string
	Port                  string
	AllowPersonalAccounts bool
}

ServerConfig holds server configuration from environment variables.

Jump to

Keyboard shortcuts

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