config

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the config directory path

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the path to the config file

func Save

func Save(cfg *Config) error

Save writes the config to file

Types

type Config

type Config struct {
	// Global settings (non-integration specific)
	ActivityDays int `json:"activity_days,omitempty" envconfig:"ACTIVITY_DAYS" default:"14"`

	// Integration configs (embedded)
	GitLab     GitLabConfig     `json:"gitlab,omitempty"`
	Jira       JiraConfig       `json:"jira,omitempty"`
	Slack      SlackConfig      `json:"slack,omitempty"`
	Loki       LokiConfig       `json:"loki,omitempty"`
	Homer      HomerConfig      `json:"homer,omitempty"`
	SQL        SQLConfig        `json:"sql,omitempty"`
	StatusLine StatusLineConfig `json:"status_line,omitempty"`
}

Config is the root configuration struct

func Load

func Load() (*Config, error)

Load reads config from file and applies environment variable overrides

func LoadFromFile

func LoadFromFile() (*Config, error)

LoadFromFile reads config from file only (no env overrides) Used when we want to modify and write back without losing env-only values

func (*Config) RequireGitLab

func (c *Config) RequireGitLab() error

RequireGitLab validates that GitLab config is present

func (*Config) RequireJira

func (c *Config) RequireJira() error

RequireJira validates that Jira OAuth config is present

func (*Config) RequireLoki added in v0.6.0

func (c *Config) RequireLoki() error

RequireLoki validates that Loki URL is configured

func (*Config) RequireSlack

func (c *Config) RequireSlack() error

RequireSlack validates that Slack bot token is present

type GitLabConfig

type GitLabConfig struct {
	URL   string `json:"url,omitempty" envconfig:"GITLAB_URL"`
	Token string `json:"token,omitempty" envconfig:"GITLAB_PERSONAL_TOKEN"`
}

GitLabConfig holds GitLab-specific configuration

type HomerConfig added in v0.32.0

type HomerConfig struct {
	URL       string                   `json:"url,omitempty" envconfig:"HOMER_URL"`
	Username  string                   `json:"username,omitempty" envconfig:"HOMER_USERNAME"`
	Password  string                   `json:"password,omitempty" envconfig:"HOMER_PASSWORD"`
	Endpoints map[string]HomerEndpoint `json:"endpoints,omitempty"`
}

HomerConfig holds Homer SIP tracing configuration

type HomerEndpoint added in v0.32.0

type HomerEndpoint struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

HomerEndpoint holds credentials for a specific Homer endpoint

type JiraConfig

type JiraConfig struct {
	ClientID     string     `json:"client_id,omitempty" envconfig:"JIRA_CLIENT_ID"`
	ClientSecret string     `json:"client_secret,omitempty" envconfig:"JIRA_CLIENT_SECRET"`
	BaseURL      string     `json:"base_url,omitempty" envconfig:"JIRA_BASE_URL"`
	CloudID      string     `json:"cloud_id,omitempty"`
	Token        *JiraToken `json:"token,omitempty"`
}

JiraConfig holds Jira-specific configuration

type JiraToken

type JiraToken struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
	CloudID      string    `json:"cloud_id,omitempty"`
	SiteURL      string    `json:"site_url,omitempty"` // Browsable URL like https://company.atlassian.net
}

JiraToken holds Jira OAuth tokens

func (*JiraToken) IsExpired

func (t *JiraToken) IsExpired() bool

IsExpired checks if the token is expired (with 1 min buffer)

type LokiConfig added in v0.6.0

type LokiConfig struct {
	URL string `json:"url,omitempty" envconfig:"LOKI_URL"`
}

LokiConfig holds Loki-specific configuration

type SQLConfig added in v0.25.0

type SQLConfig struct {
	Datasources map[string]SQLDatasource `json:"datasources,omitempty"`
}

SQLConfig holds SQL datasource configuration

type SQLDatasource added in v0.25.0

type SQLDatasource struct {
	Host     string `json:"host"`
	Port     int    `json:"port,omitempty"` // Default: 3306 for MySQL
	Username string `json:"username"`
	Password string `json:"password"`
	Database string `json:"database"`
}

SQLDatasource holds connection info for a single datasource

type SegmentConfig added in v0.22.0

type SegmentConfig struct {
	Enabled  *bool  `json:"enabled,omitempty"`
	Format   string `json:"format,omitempty"`
	CacheTTL string `json:"cache_ttl,omitempty"`
}

SegmentConfig holds configuration for a single status line segment

type SlackConfig

type SlackConfig struct {
	// OAuth credentials (for `dex slack auth`)
	ClientID     string      `json:"client_id,omitempty" envconfig:"SLACK_CLIENT_ID"`
	ClientSecret string      `json:"client_secret,omitempty" envconfig:"SLACK_CLIENT_SECRET"`
	Token        *SlackToken `json:"token,omitempty"`

	// Manual tokens (legacy, can be set directly or via OAuth)
	BotToken  string `json:"bot_token,omitempty" envconfig:"SLACK_BOT_TOKEN"`
	AppToken  string `json:"app_token,omitempty" envconfig:"SLACK_APP_TOKEN"`   // For Socket Mode
	UserToken string `json:"user_token,omitempty" envconfig:"SLACK_USER_TOKEN"` // For search API
}

SlackConfig holds Slack-specific configuration

type SlackToken

type SlackToken struct {
	AccessToken  string `json:"access_token"`            // Bot token (xoxb-...)
	UserToken    string `json:"user_token,omitempty"`    // User token (xoxp-...) if user scopes requested
	RefreshToken string `json:"refresh_token,omitempty"` // For token rotation
	TeamID       string `json:"team_id"`
	TeamName     string `json:"team_name"`
	BotUserID    string `json:"bot_user_id"`
}

SlackToken holds Slack OAuth tokens

type StatusLineConfig added in v0.22.0

type StatusLineConfig struct {
	Format   string                   `json:"format,omitempty"`
	Segments map[string]SegmentConfig `json:"segments,omitempty"`
}

StatusLineConfig holds status line configuration for Claude Code

Jump to

Keyboard shortcuts

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