Documentation
¶
Overview ¶
Package config parses and validates xray TOML configuration with line-numbered diagnostics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BugsnagConn ¶
type CircleCIConn ¶
type Config ¶
type Config struct {
Window Window
Teams map[string][]string
CaptureHarnessContent bool
Connectors Connectors
}
Config is the parsed TOML configuration.
func Load ¶
Load reads a TOML config file from path and returns the populated Config plus the toml.MetaData that produced it. The MetaData is needed by Validate for line-numbered diagnostics.
A malformed window string is reported as an error here rather than as a validation diagnostic: a window we cannot parse cannot be validated.
func (*Config) GitHubToken ¶ added in v0.4.3
GitHubToken returns the configured GitHub token, or "" when no GitHub connector is configured. Used by gitcli to authenticate clone and ls-remote against github.com without requiring ambient git auth.
func (*Config) RepoToTeam ¶
RepoToTeam returns the team a given repo slug belongs to. Empty string if the repo is not present in any team.
type Connectors ¶
type Connectors struct {
GitHub *GitHubConn
GitHubActions *GitHubActionsConn
CircleCI *CircleCIConn
Sentry *SentryConn
Bugsnag *BugsnagConn
Honeycomb *HoneycombConn
}
Connectors holds the optional per-source config. A nil pointer means the connector is not configured and is skipped at extract time.
type Diagnostic ¶
Diagnostic is a single validation problem with a source location.
func Validate ¶
func Validate(cfg *Config, meta *toml.MetaData, file string) []Diagnostic
Validate enforces the schema rules from docs/spec.md and returns one diagnostic per problem found. file is the source path used in diagnostic output.
Diagnostics are returned in source-line order so that the cli output is stable. An empty slice means the config is valid.
func (Diagnostic) Error ¶
func (d Diagnostic) Error() string
Error renders the diagnostic in the spec format:
<file>:<line>: <path>: <msg>
type GitHubActionsConn ¶
type GitHubActionsConn struct {
Token string // optional; falls back to GitHub.Token
}
type GitHubConn ¶
type GitHubConn struct {
Token string
}