Documentation
¶
Overview ¶
Package config reads the team settings committed with a vault (.okvault.yaml).
The file holds shared, non-secret settings only: tracker location, project keys, folder owners, the review interval and git policy. Credentials come from the environment, never from the vault.
Index ¶
Constants ¶
const ( GitOff = "off" // okvault never runs git (default) GitCommit = "commit" // commit okvault's writes locally GitPush = "push" // also rebase on the upstream branch and push to it GitPR = "pr" // work on a personal branch with one open GitHub pull request )
Git modes.
const ( FilterMine = "My tickets" FilterMissingDocs = "Missing docs" )
Default filter names.
const DefaultPullInterval = 5 * time.Minute
DefaultPullInterval is how often a serving okvault fetches and rebases in push and pr modes when the config does not say otherwise.
const DefaultReviewInterval = 180 * 24 * time.Hour
DefaultReviewInterval is how long a verification stays fresh when the config does not say otherwise.
const File = ".okvault.yaml"
File is the config file name at the vault root.
Variables ¶
This section is empty.
Functions ¶
func NormalizeKey ¶
NormalizeKey upper-cases a ticket key and reports whether it looks like one (ABC-123).
Types ¶
type Config ¶
type Config struct {
Tracker Tracker `yaml:"tracker"`
// Owners maps a vault folder (e.g. "ops" or "ops/runbooks") to its default
// owners. A note's own `owners` frontmatter wins; otherwise the longest
// matching folder applies. "." is the whole vault.
Owners map[string][]string `yaml:"owners"`
// ReviewInterval is how long a human verification stays fresh, e.g. "180d",
// "26w" or a Go duration. `okvault verify` sets stale_after from it.
ReviewInterval string `yaml:"review_interval"`
// Git sets how okvault records changes in the vault's git repository.
Git Git `yaml:"git"`
// contains filtered or unexported fields
}
Config is the team configuration of a vault.
func Parse ¶
Parse parses config YAML. Unknown keys are rejected so that typos and misplaced secrets (token:, password:) fail loudly instead of being committed silently.
func (*Config) BrowseURL ¶
BrowseURL returns the human link for a ticket, or "" when no tracker is configured.
func (*Config) FilterURL ¶ added in v0.5.0
FilterURL returns the Jira issue search page for a JQL query, or "" without a tracker URL.
func (*Config) TicketFilters ¶ added in v0.5.0
TicketFilters returns the configured filters, or the defaults when none are configured: the token owner's open tickets and, with a doc_label, finished tickets that lack it. Both are limited to the configured projects.
func (*Config) TicketKeys ¶
TicketKeys finds ticket keys of the configured projects in text. Without configured projects it finds nothing: a generic pattern would match UTF-8 or ISO-8601.
type Git ¶
type Git struct {
Mode string `yaml:"mode"` // off, commit, push or pr
Remote string `yaml:"remote"` // default origin
// Base is the branch pull requests target (pr mode); default the remote's default branch.
Base string `yaml:"base"`
// Branch is the working branch in pr mode; default okvault/<git user name>.
Branch string `yaml:"branch"`
// PullInterval is how often to fetch, rebase and push while serving (push
// and pr modes), e.g. "5m"; "0" means only after okvault's own writes.
PullInterval string `yaml:"pull_interval"`
// CommitEdits commits changes made outside okvault (in Obsidian, by hand)
// once the vault has been quiet this long, e.g. "10m". Empty: never.
CommitEdits string `yaml:"commit_edits"`
// contains filtered or unexported fields
}
Git holds the vault's git settings. They are team policy, so they are committed; a machine can still turn git off with `okvault serve --git off`.
type Tracker ¶
type Tracker struct {
Kind string `yaml:"kind"` // "jira", or "" / "none" for links without fetching
URL string `yaml:"url"` // e.g. https://acme.atlassian.net
Projects []string `yaml:"projects"` // project keys, e.g. [PROJ, OPS]; used to spot ticket keys
API string `yaml:"api"` // Jira REST version "3" or "2"; default 3 on atlassian.net, else 2
Browse string `yaml:"browse"` // browse URL template with {key}; default {url}/browse/{key}
// DocLabel is the Jira label a ticket gets once what the team learned on
// it is documented, e.g. "documented". It drives the default
// "Missing docs" filter.
DocLabel string `yaml:"doc_label"`
// Filters are the ticket lists the ticket workspace and kb_tickets offer,
// as JQL. Unset: "My tickets", plus "Missing docs" when doc_label is set.
// A Jira saved filter is `jql: filter = 12345`.
Filters []Filter `yaml:"filters"`
}
Tracker points at the team's ticketing system.