config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config loads and persists jiratui configuration.

Index

Constants

View Source
const (
	// AppName is the application name used for XDG paths and keyring service names.
	AppName = "jiratui"
)

Variables

View Source
var ErrSecretNotFound = errors.New("secret not found")

ErrSecretNotFound is returned when a secret is missing from keyring and environment.

Functions

func CacheDir

func CacheDir() (string, error)

CacheDir returns the directory for cached API responses.

func JiraToken

func JiraToken() (string, error)

JiraToken returns the Jira API token from environment or the OS keyring.

func MailPassword

func MailPassword() (string, error)

MailPassword returns the IONOS IMAP password from environment or the OS keyring.

func Path

func Path(explicit string) (string, error)

Path returns the config file path, honoring explicit paths and XDG_CONFIG_HOME.

func Save

func Save(path string, cfg Config) error

Save writes cfg to path using user-only permissions.

func SetJiraToken

func SetJiraToken(token string) error

SetJiraToken stores the Jira API token in the OS keyring.

func SetMailPassword

func SetMailPassword(password string) error

SetMailPassword stores the IONOS IMAP password in the OS keyring.

func StateDir

func StateDir() (string, error)

StateDir returns the directory for mutable state and logs.

Types

type Config

type Config struct {
	Jira   JiraConfig   `yaml:"jira"`
	Mail   MailConfig   `yaml:"mail"`
	Report ReportConfig `yaml:"report"`
	UI     UIConfig     `yaml:"ui"`
}

Config contains all non-secret application settings.

func Default

func Default() Config

Default returns a config with production-safe defaults.

func Load

func Load(path string) (Config, string, error)

Load reads the config from path. If path is empty, the XDG default path is used. Missing config files are not considered an error; the default config is returned.

func (Config) IsConfigured

func (c Config) IsConfigured() bool

IsConfigured reports whether the config has enough data to start the daily sprint view.

func (Config) IsJiraConfigured

func (c Config) IsJiraConfigured() bool

IsJiraConfigured reports whether Jira setup/discovery has completed.

type JiraConfig

type JiraConfig struct {
	BaseURL            string         `yaml:"base_url"`
	Username           string         `yaml:"username"`
	AccountID          string         `yaml:"account_id"`
	DisplayName        string         `yaml:"display_name"`
	ProjectKey         string         `yaml:"project_key"`
	ProjectID          string         `yaml:"project_id"`
	ProjectName        string         `yaml:"project_name"`
	BoardID            int            `yaml:"board_id"`
	IssueTypeTaskID    string         `yaml:"issue_type_task_id"`
	StoryPointsFieldID string         `yaml:"story_points_field_id"`
	StatusGroups       StatusGroups   `yaml:"status_groups"`
	CreateDefaults     map[string]any `yaml:"create_defaults,omitempty"`
}

JiraConfig contains Jira connection and workflow settings.

type MailConfig

type MailConfig struct {
	Provider        string   `yaml:"provider"`
	IMAPHost        string   `yaml:"imap_host"`
	IMAPPort        int      `yaml:"imap_port"`
	TLS             bool     `yaml:"tls"`
	Username        string   `yaml:"username"`
	From            string   `yaml:"from"`
	To              []string `yaml:"to"`
	CC              []string `yaml:"cc,omitempty"`
	DraftsMailbox   string   `yaml:"drafts_mailbox"`
	SubjectTemplate string   `yaml:"subject_template"`
}

MailConfig contains IONOS IMAP draft settings.

type ReportConfig

type ReportConfig struct {
	ProjectLabel        string `yaml:"project_label"`
	Timezone            string `yaml:"timezone"`
	OnlyMyStatusChanges bool   `yaml:"only_my_status_changes"`
	BlockersDefault     string `yaml:"blockers_default"`
	DeliveryDefault     string `yaml:"delivery_default"`
	TodoNextLimit       int    `yaml:"todo_next_limit"`
}

ReportConfig contains daily report generation settings.

type StatusGroups

type StatusGroups struct {
	Done       []string `yaml:"done"`
	InProgress []string `yaml:"in_progress"`
	Blocked    []string `yaml:"blocked"`
}

StatusGroups maps Jira status names to jiratui buckets.

type UIConfig

type UIConfig struct {
	Mouse      bool   `yaml:"mouse"`
	Icons      bool   `yaml:"icons"`
	Animations bool   `yaml:"animations"`
	Theme      string `yaml:"theme"`
}

UIConfig contains terminal UI preferences.

Jump to

Keyboard shortcuts

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