Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LibraryName ¶
func LibraryName(provider string, repoName string, ref RefConfig, page PageConfig) string
LibraryName returns the library name for a given source context. For git: repo.Name/ref.Ref unless ref.Name is set. For confluence: page.Name if set, else page.Space/page.ID.
func ResolvePath ¶
ResolvePath finds the config file to use. Priority:
- explicit (non-empty string passed by caller)
- $DOCSERVE_CONFIG environment variable
- ./docserve.yaml
- /etc/docserve/docserve.yaml
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Type string `yaml:"type"` // "basic", "bearer", or "" (github token)
TokenEnv string `yaml:"token_env"`
UsernameEnv string `yaml:"username_env"`
PasswordEnv string `yaml:"password_env"`
}
AuthConfig holds authentication settings for a provider or repo.
type Config ¶
type Config struct {
DataDir string `yaml:"data_dir"`
Listen string `yaml:"listen"`
Proxy ProxyConfig `yaml:"proxy"`
Providers []ProviderConfig `yaml:"providers"`
}
Config holds the full docserve configuration.
type PageConfig ¶ added in v1.0.1
type PageConfig struct {
Name string `yaml:"name"`
Space string `yaml:"space"`
ID string `yaml:"id"`
Depth *int `yaml:"depth"` // nil -> -1 (unlimited)
}
PageConfig describes a Confluence page to index.
type ProviderConfig ¶ added in v1.0.1
type ProviderConfig struct {
Type string `yaml:"type"` // "github", "azure-devops", "confluence"
BaseURL string `yaml:"base_url"` // required for azure-devops, confluence
Proxy bool // default true; handled via custom UnmarshalYAML
Schedule string `yaml:"schedule"`
Auth AuthConfig `yaml:"auth"`
Repos []RepoConfig `yaml:"repos"` // git providers only
Pages []PageConfig `yaml:"pages"` // confluence only
}
ProviderConfig describes a documentation provider and its repositories or pages.
func (*ProviderConfig) UnmarshalYAML ¶ added in v1.0.1
func (p *ProviderConfig) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler so that Proxy defaults to true.
type ProxyConfig ¶
ProxyConfig holds HTTP/HTTPS proxy settings.
type RefConfig ¶
type RefConfig struct {
Name string `yaml:"name"` // optional, override library name
Ref string `yaml:"ref"` // branch/tag/sha
Paths []string `yaml:"paths"`
}
RefConfig describes a single ref (branch/tag) within a repo.
type RepoConfig ¶ added in v1.0.1
type RepoConfig struct {
Name string `yaml:"name"` // required
Slug string `yaml:"slug"` // owner/repo (github) or repo name (azure-devops)
Project string `yaml:"project"` // azure-devops only
Schedule string `yaml:"schedule"` // override provider schedule
Auth AuthConfig `yaml:"auth"` // override provider auth
Refs []RefConfig `yaml:"refs"`
}
RepoConfig describes a repository within a git provider.
type ResolvedSource ¶ added in v1.0.1
type ResolvedSource struct {
// Common
Name string
Provider string // "github", "azure-devops", "confluence"
BaseURL string
Proxy bool
Schedule string
Auth AuthConfig
// Git providers
Slug string // owner/repo or repo name
Project string // azure-devops only
Refs []RefConfig
// Confluence
Pages []PageConfig
}
ResolvedSource is a fully resolved source with auth/schedule/proxy inherited from the provider. This is what the rest of the codebase consumes.
func FlattenProviders ¶ added in v1.0.1
func FlattenProviders(providers []ProviderConfig) []ResolvedSource
FlattenProviders converts hierarchical ProviderConfig entries into a flat list of ResolvedSource entries suitable for the rest of the codebase. For git providers (github, azure-devops): one ResolvedSource per repo. For confluence: one ResolvedSource per provider (with all pages).