Documentation
¶
Overview ¶
Package config loads configuration with precedence defaults < YAML < GITDR_* env. Secrets never come from YAML, only env or a mounted file by path, and are wrapped in redact.Secret so they can't leak into logs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureConfig ¶
type AzureConfig struct {
Account string `yaml:"account"`
Container string `yaml:"container"`
Endpoint string `yaml:"endpoint"`
ConnectionString redact.Secret `yaml:"-"`
}
AzureConfig configures the Azure Blob backend. The connection string is a secret (env only); real Azure uses DefaultAzureCredential with account/endpoint.
type BackupConfig ¶
type BackupConfig struct {
Concurrency int `yaml:"concurrency"` // parallel repos; default 4
Resume bool `yaml:"resume"` // skip repos already backed up for the run date
LFS bool `yaml:"lfs"` // fetch Git LFS objects; default true
}
BackupConfig configures fan-out across repositories.
type Config ¶
type Config struct {
Source SourceConfig `yaml:"source"`
Destination DestinationConfig `yaml:"destination"`
Backup BackupConfig `yaml:"backup"`
Manifest ManifestConfig `yaml:"manifest"`
Metrics MetricsConfig `yaml:"metrics"`
Encryption EncryptionConfig `yaml:"encryption"`
WORM WORMConfig `yaml:"worm"`
Log LogConfig `yaml:"log"`
}
Config is the full gitdr configuration.
func Load ¶
Load reads config from path (may be empty for "defaults + env only"), then applies environment overrides.
func (*Config) EncryptionKeyMaterial ¶
EncryptionKeyMaterial returns the raw encryption key material (from env) when encryption is enabled, or nil when disabled. The crypto package parses/validates it.
func (*Config) ResolveGitHubPrivateKey ¶
ResolveGitHubPrivateKey returns the GitHub App private key PEM from env (preferred) or the configured file path.
func (*Config) ResolveManifestPublicKey ¶
ResolveManifestPublicKey returns the manifest public key from the configured path.
func (*Config) ResolveManifestSigningKey ¶
ResolveManifestSigningKey returns the manifest signing key from env (preferred) or the configured file path.
type DestinationConfig ¶
type DestinationConfig struct {
Type string `yaml:"type"` // "s3" (AWS + S3-compatible) | "gcs" | "azure"
S3 S3Config `yaml:"s3"`
GCS GCSConfig `yaml:"gcs"`
Azure AzureConfig `yaml:"azure"`
Retention RetentionConfig `yaml:"retention"`
}
DestinationConfig configures the storage destination.
type EncryptionConfig ¶
EncryptionConfig configures optional client-side envelope encryption. The key is a 32-byte AES-256 KEK supplied via env (GITDR_ENCRYPTION_KEY), never YAML.
type GCSConfig ¶
type GCSConfig struct {
Bucket string `yaml:"bucket"`
Endpoint string `yaml:"endpoint"` // empty = real GCS; set for an emulator
}
GCSConfig configures the Google Cloud Storage backend.
type GitHubConfig ¶
type GitHubConfig struct {
AppID int64 `yaml:"appID"`
InstallationID int64 `yaml:"installationID"`
PrivateKeyPath string `yaml:"privateKeyPath"`
PrivateKey redact.Secret `yaml:"-"` // injected from env only; never from YAML
}
GitHubConfig holds GitHub App installation credentials. The private key itself is supplied via env (GITDR_GITHUB_APP_PRIVATE_KEY) or a file at PrivateKeyPath.
type GitLabConfig ¶
GitLabConfig holds the GitLab read-scoped access token (env only; never YAML).
type LogConfig ¶
type LogConfig struct {
Level string `yaml:"level"` // debug|info|warn|error
Format string `yaml:"format"` // json|text
}
LogConfig configures structured logging.
type ManifestConfig ¶
type ManifestConfig struct {
SigningKeyPath string `yaml:"signingKeyPath"`
PublicKeyPath string `yaml:"publicKeyPath"`
SigningKey redact.Secret `yaml:"-"` // injected from env only; never from YAML
}
ManifestConfig configures run-manifest signing/verification keys. The signing key is supplied via env (GITDR_MANIFEST_SIGNING_KEY) or a file at SigningKeyPath.
type MetricsConfig ¶
type MetricsConfig struct {
// TextfilePath is the .prom file node_exporter's textfile collector scrapes.
// Empty disables metrics output.
TextfilePath string `yaml:"textfilePath"`
}
MetricsConfig configures Prometheus textfile-collector output.
type RetentionConfig ¶
type RetentionConfig struct {
Mode string `yaml:"mode"` // COMPLIANCE (default) | GOVERNANCE
Days int `yaml:"days"` // retain-until = now + Days
}
RetentionConfig configures object-lock retention applied to every write.
type S3Config ¶
type S3Config struct {
Bucket string `yaml:"bucket"`
Region string `yaml:"region"`
Endpoint string `yaml:"endpoint"` // empty = AWS; MinIO/Wasabi/B2 set their endpoint
UsePathStyle bool `yaml:"usePathStyle"` // true for MinIO and most S3-compatible stores
}
S3Config configures the S3 (and S3-compatible) backend.
type SourceConfig ¶
type SourceConfig struct {
Type string `yaml:"type"` // "github" (only backend in this build)
BaseURL string `yaml:"baseURL"` // empty = github.com; GHES sets https://host/api/v3 (M2+)
Repo string `yaml:"repo"` // single-repo selector "owner/name" (walking skeleton)
Include []string `yaml:"include"`
Exclude []string `yaml:"exclude"`
GitHub GitHubConfig `yaml:"github"`
GitLab GitLabConfig `yaml:"gitlab"`
}
SourceConfig configures the VCS source.
type WORMConfig ¶
type WORMConfig struct {
// Require maps to --require-worm. Default false: if the destination is not provably
// immutable, gitdr warns loudly and proceeds. Set true to fail closed instead.
Require bool `yaml:"require"`
}
WORMConfig configures the immutability check. WORM is recommended, not required.