Documentation
¶
Overview ¶
Package config handles TOML configuration parsing, environment variable overrides, and validation for Anchor LFS.
Index ¶
Constants ¶
const ( StorageLocal = "local" StorageS3 = "s3" )
Storage backend names.
const DefaultConfigPath = "config.toml"
DefaultConfigPath is the file path used when no override is provided.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Options Options `toml:"options"`
Storage Storage `toml:"storage"`
Endpoints []Endpoint `toml:"endpoints"`
}
Config is the top-level configuration structure.
type Endpoint ¶
type Endpoint struct {
Name string `toml:"name"`
URL string `toml:"url"`
Path string `toml:"endpoint"` // "endpoint" in TOML for user clarity; "Path" in Go to avoid stuttering with the type name.
Visibility string `toml:"visibility"`
Authentication string `toml:"authentication"`
GitHubAPIURL string `toml:"github_api_url"`
// Parsed from URL at load time.
GitHubOwner string `toml:"-"`
GitHubRepo string `toml:"-"`
GitHubBaseURL *url.URL `toml:"-"`
}
Endpoint configures a single repository whose LFS objects will be served.
func (*Endpoint) AuthMethod ¶
AuthMethod returns the normalised authentication method name.
type Options ¶
type Options struct {
ListenAddress string `toml:"listen_address"`
DataDirectory string `toml:"data_directory"`
AdditionalLogging bool `toml:"additional_logging"`
BaseURL string `toml:"base_url"`
MaxUploadSize int64 `toml:"max_upload_size"`
// Rate limiting.
RateLimitTokens uint64 `toml:"rate_limit_tokens"`
RateLimitInterval time.Duration `toml:"-"`
RateLimitWindow string `toml:"rate_limit_window"`
// Auth cache.
AuthCacheTTL string `toml:"auth_cache_ttl"`
AuthCacheDuration time.Duration `toml:"-"`
// URL signing.
SigningKey string `toml:"signing_key"`
SigningKeyBytes []byte `toml:"-"`
URLExpiry string `toml:"url_expiry"`
URLExpiryDuration time.Duration `toml:"-"`
}
Options holds global server settings.
type Storage ¶
type Storage struct {
Backend string `toml:"backend"`
S3Bucket string `toml:"s3_bucket"`
S3Region string `toml:"s3_region"`
S3Endpoint string `toml:"s3_endpoint"`
S3AccessKeyID string `toml:"s3_access_key_id"`
S3SecretAccessKey string `toml:"s3_secret_access_key"`
S3Prefix string `toml:"s3_prefix"`
S3PresignedURLs *bool `toml:"s3_presigned_urls"`
S3ForcePathStyle *bool `toml:"s3_force_path_style"`
}
Storage configures the object storage backend.
func (*Storage) S3ForcePathStyleEnabled ¶
S3ForcePathStyleEnabled returns whether path-style addressing is enabled, defaulting to false when unset.
func (*Storage) S3PresignedURLsEnabled ¶
S3PresignedURLsEnabled returns whether presigned URLs are enabled, defaulting to true when unset.