Documentation
¶
Overview ¶
Package config loads runtime configuration from a single config.yaml file. Secrets are read separately from the environment (optionally via a .env file in development) and never appear in the YAML.
All secret values use the Secret type so they cannot leak through logging.
Index ¶
Constants ¶
const DefaultConfigFile = "./config.yaml"
DefaultConfigFile is used when NOTIFYCAT_CONFIG_FILE is unset.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ConfigFile is the path config.yaml was loaded from; the sibling
// config.lock is derived from it.
ConfigFile string
// GitProvider is the required git_provider enum ("github"). It selects which
// provider's secrets are required (see readSecrets) and hashes into every
// lock entry (see routing Entry.Provider).
GitProvider kernel.Provider
Addr string
LogLevel string
LogFormat string
DatabaseURL string
SlackBaseURL string
GitHubBaseURL string
BitbucketBaseURL string
Domain string
MessageTTLDays int
IgnoreAIReviews bool
DependabotFormat bool
Reactions Reactions
Digest *routingdomain.DigestConfig
Mappings map[string]routingdomain.Org
// DigestTimezone is the resolved timezone the digest scheduler and reporter
// run in. Derived from Digest.Timezone at Load (default UTC); never nil.
DigestTimezone *time.Location
GitHubWebhookSecret Secret
SlackBotToken Secret
GitHubToken Secret
// BitbucketWebhookSecret is required when git_provider is bitbucket (see
// requireProviderSecret). BitbucketToken is the optional read credential with
// exact GITHUB_TOKEN degradation parity (absent ⇒ path rules inert +
// validation probes skip). BitbucketAuthEmail, when set, pairs with the token
// to switch the Bitbucket client to HTTP Basic (the Free-plan wildcard path).
BitbucketWebhookSecret Secret
BitbucketToken Secret
BitbucketAuthEmail string
// SlackSigningSecret gates the inbound Slack interactivity endpoint
// (POST /webhook/slack/interactions). Optional: when empty the endpoint is
// not registered and notifycat behaves exactly as an outbound-only service.
SlackSigningSecret Secret
}
Config is the parsed runtime configuration. Field names are flat so consumers read cfg.Addr, cfg.Reactions.NewPR, etc.; the nested config.yaml shape is an internal detail of Load (see fileSchema).
func Load ¶
Load reads .env (secrets only; absent is fine), decodes config.yaml over the defaults, reads secrets from the environment, and validates.
func (Config) ProviderToken ¶ added in v0.22.0
ProviderToken returns the optional read token for the selected git provider (GitHubToken for github, BitbucketToken for bitbucket). Empty when unset; an empty token degrades path routing and validation probes identically for both providers.
func (Config) ProviderTokenVar ¶ added in v0.22.0
ProviderTokenVar is the environment-variable name of the selected provider's read token, used in the path-routing degradation messages.
func (Config) ProviderWebhookSecret ¶ added in v0.22.0
ProviderWebhookSecret returns the required webhook secret for the selected git provider (GitHubWebhookSecret or BitbucketWebhookSecret).
func (Config) ProviderWebhookSecretVar ¶ added in v0.22.0
ProviderWebhookSecretVar is the environment-variable name of the selected provider's webhook secret, used in doctor's config report.
type MissingVarError ¶
type MissingVarError struct{ Var string }
MissingVarError is returned when a required secret env var is unset or empty.
func (*MissingVarError) Error ¶
func (e *MissingVarError) Error() string
type Reactions ¶
type Reactions struct {
Enabled bool
NewPR string
MergedPR string
ClosedPR string
Approved string
Commented string
RequestChange string
BotReview string
}
Reactions configures Slack reaction emoji names per PR lifecycle event.
type Secret ¶
type Secret string
Secret wraps a sensitive string (API token, webhook secret, password).
Its zero value is the empty string. Stringer, formatting verbs, and slog rendering all return a redaction placeholder so the raw value never reaches logs by accident. Use Reveal when handing the value to an external system.
func (Secret) Format ¶
Format intercepts every Sprintf verb (%v, %s, %q, %+v, …) so we cannot leak the raw value through an unfamiliar verb.