Documentation
¶
Overview ¶
Package config loads and exposes application configuration via Viper, including API connection settings, upload tuning, and telemetry options.
Index ¶
- func FormatAttributeLines(attrs map[string]string) string
- func MetadataPath() (string, error)
- func ParseAttributes(input string) (map[string]string, error)
- func ParseTags(input string) ([]string, error)
- func ReadInConfig(explicitPath string) error
- func SaveMetadata(meta Metadata) (string, error)
- type Config
- type FileMetadataRepository
- type Metadata
- type MetadataPathResolver
- type MetadataRepository
- type TelemetryCfg
- type UploadCfg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAttributeLines ¶
FormatAttributeLines renders attributes as sorted key=value lines.
func MetadataPath ¶
MetadataPath exposes the configured metadata file location.
func ParseAttributes ¶
ParseAttributes converts newline-delimited key=value pairs to a map.
func ReadInConfig ¶
ReadInConfig configures Viper for Astrolabe and reads the active config file. Missing default config files are tolerated; explicit config paths must resolve cleanly.
func SaveMetadata ¶
SaveMetadata writes the metadata document to disk, ensuring directory creation.
Types ¶
type Config ¶
type Config struct {
APIURL string
ProjectID string
AuthToken string
OfflineCache string
Upload UploadCfg
Telemetry TelemetryCfg
}
Config is the top-level application configuration populated from the connection.yml file, environment variables, and CLI flags.
type FileMetadataRepository ¶
type FileMetadataRepository struct {
// contains filtered or unexported fields
}
FileMetadataRepository persists metadata to disk using a configurable path resolver.
func NewFileMetadataRepository ¶
func NewFileMetadataRepository(resolver MetadataPathResolver) *FileMetadataRepository
NewFileMetadataRepository constructs a repository that resolves its path on demand.
func (*FileMetadataRepository) Load ¶
func (r *FileMetadataRepository) Load() (Metadata, error)
func (*FileMetadataRepository) Path ¶
func (r *FileMetadataRepository) Path() (string, error)
type Metadata ¶
type Metadata struct {
Operator string `json:"operator,omitempty"`
Location string `json:"location,omitempty"`
Device core.DeviceInfo `json:"device"`
Test core.TestInfo `json:"test"`
Tags []string `json:"tags,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
}
Metadata captures operator, device, and test context common to CLI and TUI workflows.
func LoadMetadata ¶
LoadMetadata reads the persisted metadata file if present, returning defaults otherwise.
type MetadataPathResolver ¶
MetadataPathResolver returns the metadata file path.
type MetadataRepository ¶
type MetadataRepository interface {
Load() (Metadata, error)
Save(Metadata) (string, error)
Path() (string, error)
}
MetadataRepository defines the contract for loading and saving metadata.
type TelemetryCfg ¶
type TelemetryCfg struct {
Enabled bool // opt-in for anonymous metrics
Backend string // "expvar" (default), "prometheus", or "none"
}
TelemetryCfg controls the anonymous metrics collection backend.